Multithreading Questions
Ad
Can a thread be created and joined by different threads?
If a creates thread b and c with pthread_create, can b call pthread_join on c (assuming the thread_id
Sharing mutexes stored on the main thread's stack with a child thread
While experimenting with c11 threads.h and mutexes to synchronise a network thead and a main thread i started using following procedure:
Running client and server socket connection in C - With threads
I am trying to create a simple socket connection of a client and a server. i wrote something very basic, following
C: Does locking a pthread mutex place the thread in a FIFO queue?
Lets say thread 1 has locked the mutex and does some work. if thread 2 calls:
How to get the number of active threads started by specific class?
Code looks like below: class workers1(thread): def __init__(self): thread.__init__(self) def run(self): #
How to get the number of threads in a Java process
How can i see the number of threads in a java process?
Best Way to Split Server Process
I am working on a building a server in c which not only listens for incoming connections, but also provides me with an interactive shell.
Open MP bottleneck issue
I was trying to observe a basic openmp based parallelism with the following code, #include<stdio.h> #include<omp.h>
Windows set maximum number of threads in default thread pool
Starting with windows vista, every application automatically gets a
Ad
Timered operations in a critical section [C]
I'm coding in c on ubuntu. i need to write a thread called for example "timeredthread" that do some operations in a critical
Kill thread during it's waiting for pthread_mutex_lock
I'm coding in c on ubuntu. i have more than 2 threads like this: void * thread(void) { retry:
Calculating sum using parallel programming
I want to add 1 to a number(0) for 10 billion times. i tried two approaches - use a single thread (main thread) to do the work.
Editing structure instance's member values inside single/multiple thread(s)
I am attempting to edit a structure's member value(s) within single/multiple threads on windows, consider the following example:
Share scoped variable in OpenMP
I'm working with openmp and would like to share variable that's declared inside scoped block between threads. here's overall idea of what i'm
Thread safety... what's my "best" course of action?
I'm wondering what is the "best" way to make data thread-safe. specifically, i need to protect a linked-list across multiple threads --
Can I Set The Number Of Threads From An External FIle in Apache Jmeter?
I have many jmeter scripts that are testing different scenarios and i want to create a configuration file for some common values across my
How can I set the number of OpenMP threads from within the program?
Running the program as $ omp_num_threads=4 ./a.out limits the number of active openmp threads to 4, as
Is access to different elements in a C array thread safe?
Say if i have the following c code: int my_global_arr[100]; or more
Repeating Barrier in synchronized programming in C win32 api
I have a task that includes this concept and i have no idea how to implement it. the basic idea is we have a movie theater that has x seats
How can i get a list of currently running threads in objective-C(iphone)
Is there a way to get the list of currently running threads in objective-c? i'm mostly interested in getting the nsthreads objects, cause i want
Ad
How can I get a list with all the threads created by my application
I want to get a list with all the threads (except the main, gui thread) from within my application in order to do some action(s) with them. (set
On Win32 how do you move a thread to another CPU core?
I'd like to make sure that a thread is moved to a specific cpu core and can never be moved from it by the scheduler. there's a
Can anyone explain thread monitors and wait?
Someone at work just asked for the reasoning behind having to wrap a wait inside a synchronized. honestly i can't see the reasoning. i
C# equivalent to java's wait and notify?
I am aware that you can lock an object in c# using lock but can you give up the lock and wait for something else to notify you that it's changed
Wait until any of Future<T> is done
I have few asynchronous tasks running and i need to wait until at least one of them is finished (in the future probably i'll need to wait util m
Any experiences with Intel's Threading Building Blocks?
Intel's threading building blocks (tbb) open source library looks really
How to change Listener Thread Priority
I use the tidcmdtcpserver component of indy 10 to realize my client-server application. the problem is that the request from clients can be fairly
Erlang-style Concurrency for Other Languages
What libraries exist for other programming languages to provide an erlang-style concurrency model (processes, mailboxes, pattern-matching receive,
How do I make this program thread-safe, would channels be the best implementation, if so, how?
I'm using golang, i'm trying to make this program thread-safe. it takes a number as a parameter (which is the number of consumer tasks to start),
How to lock a sequence of methods, such that other thread call those same method should be waiting?
Suppose there is one thread and it has a sequence of methods to be executed: public void task(){ method(); method();
Thread-safe use of a singleton's members
I have a c# singleton class that multiple classes use. is access through instance to the toggle() method thread-safe? if
Ad
Instance constructor sets a static member, is it thread safe?
I am re-factoring some code and am wondering about the use of a lock in the instance constructor. public class
Pthread data race that drives me crazy
I posted a similar question to this one a few weeks ago where i had trouble finding the data race in my n-queens program using pthreads in c.
Which is a better approach in logging - files or DB?
Okay, here's the scenario. i have a utility that processes tons of records, and enters information to the database accordingly. it works
Why nodejs fs sync synchronous apis block the main thread (even loop) when it should be execute on the worker pool (default of nodejs)?
This is a theory question, i previously thought that in nodejs expensive tasks like i/o, network,... will be executed on a worker in
WaitForMultipleObjects doesnt wait until all threads finish
What i want are 5 threads that print something indefinitely. i used the waitformultipleobjects api to wait until the threads finish
Python Subprocess readline() hangs; can't use normal options
To start, i'm aware this looks like a duplicate. i've been reading:
How to Prevent a Node.js 12 worker Thread from terminating immediately?
I have a node.js application running an express server and a
How to use multiprocess/multithreading to read csv file and store it in generated new variables?
i have a list of filenames and use it to generate string which will be the new variable to store dataframe. the code below it's not
How to run all the robot files inside current directory
I have robot files inside a directory i need to run all the robot file inside it in sorted order. below is my code. is it right code or
Need to run 2 functions at the same time but, but they only run one after another
I have 2 functions def print_out(string): typing_speed = engine.getproperty('rate') #wpm
Multithreading a numpy nditerator
For an mcmc implementation, i want to calculate the covariance tensor c in numpy. working single-threaded code the distance
Ad
Where to use CalendarPickerView's highlight() so that it has effect?
Idea: i want to highlight some days in the calendarpickerview to indicate that user cannot choose them.
Process a list with a limted number of threads
I want to process a list with a limited number of threads, i want them to take turns, until the list is empty. i tried the following
Read NFC tag until it is detached and update the UI while reading the tag
I want to read an nfc tag until the device moves away from the nfc tag. then i want to do some activities. i have managed to do this using a while
How are errors handled within threads in Python?
I am using threadpoolexecutor to execute a function which causes an error. when an error is caused within a thread (and its not
PyQT : How to pass a webdriver object from QThread to UI thread?
I'm making a program that automatically enters to a website and login(basically using selenium and chrome webdriver). user can type own
How to improve performance of querying data from Salesforce with Python?
Are there any solution we can retrieve salesforce data from python with more than 2000 records for each chunk? i have used rest api to retrieve
How to measure time taken of multi-threads created in a loop?
I want to measure how much time it takes to finish running the code with multiple threads in python. if i put join inside the loop, it
How to run two functions in parallel with threading in Python?
I want to run two functions in parallel which print two lists in parallel. but what i get is one list, being printed after the other list has
Should I use asyncio or thread pool for gain performance in api requests?
I want to make a real time face recognizer with azure cognitive service's face api. but the api calls takes so much time. what concept should i
How to correctly store user input (keyboard,mouse) in file using keyboard & mouse Python modules?
I am using the keyboard and mouse modules to record user interaction with our software so that we can have some high level gui tests. currently i
Are there any downsides to choosing not to join threads in Rust?
I have a program that uses multiple threads to brute force the decryption of some encrypted string. the main thread has a channel, and the sender
Ad
Implementation of custom async task not working
I am trying to create my own implementation of android asynctask. for that i created an abstract class which extends thread class. i declared
I cannot understand why this thread situation doesn't work <Thread lock doesn't work>
I used the threading.lock() not to threads access to the shared resource at the same time. but, in my code case, it doesn't work. i know
Unable to get output using multiprocessing in python
I am trying to do feature extraction for my dataset using multiprocessing, each processor for each subject. i have 12 logical processors , and i
How do async/await/then really work in Dart?
This is maybe a recurring question but i found conflicting answers and i'm now confused as to which of them is the correct one. i thought
Python Threading - Crash with multiple threads
I wrote a small python script using python's threading module for multi-threading. the target function that gets called by
Java function return a value before the function is executed
I'm currently developping an android app which is accessing to an online api. i have a class dedicated to this task, and another class that just
Is my implementation of AppExecutors correct in this case?
I once came across this appexecutors class from some github sample project but i forgot where. i just found it very handy as it does
Handler's `handleMessage` returning thread id of main thread instead that of the worker thread
I'm trying to get a hang of multi-threading in android. my aim is to send data from the main thread to a worker thread. i have a main
How can I play random audio files based on current time in Python 2.7?
Background: i'm using as raspberry pi rev 2 b to run a nature sound white noise generator of sorts that will randomly play audio
Android Firebase: How is OnCompleteListener working asynchronously if it called on main application thread?
I've written a code to create a new account using firebase auth: public static int signup(string email, string password) {
Android & Kotlin Coroutines: Is it possible to run out of threads?
How to find out if i am running out of threads in android/kotlin? i am building an app where i need to load a lot of data from a remote api. i add
Ad
Processing a multidimensional array with worker_threads
I have an interesting task, but i was even confused in learning workers. there is an array of dimensions of 10-30k objects. i want to break it
Proper way to thread in kotlin
I have thread code block which basically displays progress bar for 2 seconds then shows a recycler view. i wonder if there is more proper way to
Python: what does Thread.is_alive *exactly* mean?
In python 3.9.10, i am stumbling on the following very unsettling behaviour: class mythread(threading.thread): def run(self):
Passing a result array into pthread_join
I have the below code but i'm not understanding why the results aren't printing out correctly. i'm allocating val to be the size of the number of
Update Multiple Views from Multiple Threads from Seperate External Classes
I am working on a game project. i want to associate each view of my game to its respective thread and then update the view according to the logic
Multiple consumer Rabbitmq through multiprocessing
New to python. i am trying to create multiple consumer for a rabbitmq client. i am using pika and trying to do with multiprocessing. it seems
Passing parameters to a function invoked in a separate thread
Consider the following java code on android. i start threads in a for loop. inside the thread, i am invoking a method with parameters that are
How to pass static argument to python threadpool map
Assume i have a function that i call in a multi-threaded environment like below: from multiprocessing.pool import pool as
Usage of Semaphores in Python
I am trying to use a semaphore in python to block the execution of a thread, and release the semaphore in another thread depending on some
AsyncTask as kotlin coroutine
Typical use for asynctask: i want to run a task in another thread and after that task is done, i want to perform some operation in my ui thread,
How to unblock a Condition using a Timer in Python?
I have a locked conditional variable, which is in waiting state. i want to notify it from a separate thread using a timer. the lock is acquired
Ad
Sequentially execute webhooks received in node application
I have a node application using koa. it receiving webhooks from external application on specific resources. to illustrate let say the
Synchronously executing long running methods in a Service
I have an android service that has a set of operations : myservice.java public class myservice extends
Immediately raise exceptions in concurrent.futures
I run several threads concurrently using concurrent.futures. all of them are necessary to run successfully for the next steps in the
Kotlin Coroutines: one single coroutine at a time in single thread
Consider this code below, i'm trying to use executors.newfixedthreadpool(1).ascoroutinedispatcher() to create a single thread
Can't make function return value wait for fetched result - Now multithreaded
Previously i asked this question in a single threaded situation, and was given an answer that worked in that situation
In android, what should I do if I run network request in thread but don't want to refresh UI until response comes back?
Like i need to check whether a username already existed in database, and the program won't continue until response arrives.
What happens when multiple threads are writing to a single table in mysql?
I am facing a situation where multiple threads are trying to insert data to the same table in mysql, **will it be ok without explicit handle it?
How to correctly update view in pyQt after editing abstract model in another thread?
I'm trying to setdata() of my qabstracttablemodel (which is connected to qtableview) from another threading.thread. data in model changing as
Locating thread leak in Node.js
So i have this node application running on ubuntu. and i noticed that there're lots of threads showing up form pstree -a
Android Library thread safe
I've a small android library which handles a serial port, it has basic functionality like open, read, write and close. i have made an
Python - How to return the data from a thread
I'm currently working on a gui where the user inputs data and clicks on a button to run a function that draws a canvas. the function that
Ad
The Strange behavior of CompletableFuture
Why the below code does not print i just woke up import java.util.concurrent.completablefuture; public class
Python multithreaded server and asynchronuous websocket communication with Android clients
I have an android client app that sends some data to a server in python, where the python server is supposed to run a long time-consuming
python multithreaded server recieves two requests from browser
I'm attempting to create a simple threaded server in python. when making a call in a browser it seems that two requests are made, which cause the
What is the best and efficient way to do "multithreading" in node.js?
I'have been trying out the module "tiny-worker", but i feel that it's pretty slow to communicate between a worker thread and main thread using
Multiprocessing.Queue with hugh data causes _wait_for_tstate_lock
An exception is raised in threading._wait_for_tstate_lock when i transfere hugh data between a process and a
How to set up bottlepy with threading for processing in background
I'm trying to set up a web service that processes a rendering in background, which takes a minute. while the rendering is in progress i want the
UnboundLocalError: local variable 'zipped' referenced before assignment: Generator Error
I'm trying to build semantic segmentation model in keras. since i use a custom data, i decided to write a custom generator to feed it to the keras
Thread Handling on AppDelegate.Swift
My app was recently rejected by apple for the following: exception type: exc_crash (sigkill) exception codes: 0x0000000000000000,
What happens to a thread executing a method as target
I use some multi-threading in my python application. i want to know what happens to a thread object after it finishes executing the "target"
How to stop a Python daemon thread with infinite loop at shutdown?
Suppose i have something like this : import threading import time _finish = false def hang(): while true: if
Error nested std::thread inside a thread throws an error
I'm trying to get this simple test to create a nested thread inside another thread, but it keeps failing. tried removing this nested function and
Ad
Does python queue use the GIL?
Does the python thread safe queue use the gil, or does it use
Is there a way to read mouse wheel data inside while loop without locking while loop in ubuntu in C?
Hello the masters of c and c++. i am trying to get mouse wheel data in while loop using read function. i am in ubuntu 20.04 and using c
Ad
Blog Categories
Ad