multithreading

ThreadPool vs dedicated Thread - when to prefer which

Is there any way (apart form actual perfomance measurements which can be pretty hard to make them realistic) or rule of thumb when I should stop using the ThreadPool and use a dedicated Thread instead? I suppose for long running work it is better to use a dedicated Thread because it doesn't peramently steal one from the ThreadPool. For s...

Use of ThreadDeath under Error

What is the purpose of ThreadDeath under Error which is under Throwable? ...

Sharing data array among threads-C++

I know that there are similar questions which are already answered, but I am asking this question since they don’t exactly give what I would like to know. This is about synchronization between threads. The idea of my project is that we obtain data from a data acquisition card and plot and analyze data during data acquisition. So far, I ...

Android MapActivity thread question

How do I ensure code is or is not executed on the UI thread in an Android MapActivity project? I am developing an Android map-based application, but I have experienced some stability issues and my research has led me to believe I need to ensure that screen updates are carried out on the UI thread. My app has data coming in from a GPS l...

IPython threading server execfile()

My problem is the following: I would like to open an instance of ipython in a terminal of mine by simply typing, as usual: $ ipython -pylab and be able to have other processes order this ipython instance to execute a file as the execfile() would. This could be any other process, for instance, vim could ask ipython to run the currently...

Disable All Events on a Windows Form

Is there any way to temporarily disable ALL events on an windows form? I have situation where processing on a secondary thread is being corrupted by events on the main thread. (The main thread events are modifying the contents of controls that are data-bound to variables used by the secondary thread.) Looking for a way to "lock" the...

Thread type for TCP Accept loop: BackgroundWorker, Thread, or ThreadPool

I'm writing a TCP server, and at the very heart of it is a fairly standard bind-listen-accept piece of code nicely encapsulated by TcpListener. The code I'm running in development now works, but I'm looking for some discussion of the thread model I chose: // Set up the socket listener // *THIS* is running on a System.Th...

PyQT and threads

I am developing an application that uses multiple threads to gather data from a variety of network devices. I'm using PyQT to display the collected data on a GUI. I am using regular python threads (from thread, threading) in my app (instead of QThread). In order to update the GUI on the different threads, I use a lock (thread.allocate_l...

Thread interrupt not ending blocking call on input stream read

I'm using RXTX to read data from a serial port. The reading is done within a thread spawned in the following manner: CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(port); CommPort comm = portIdentifier.open("Whatever", 2000); SerialPort serial = (SerialPort)comm; ...settings Thread t = new Thread(new SerialRea...

Why are slots being called from the main thread?

I have a Qt application that has two threads: the main thread that handles the GUI and a second thread that manages network connections. Here is the thread code: void thread::run() { QTcpServer server; server.connect(&server,SIGNAL(newConnection()),this,SLOT(OnConnect())); //... } When I put a breakpoint at the start of ...

C++ view Mutex value in watch window

Hi, is it possible to view the value of a Mutex or Semaphore in Watch winodw in debug mode? ...

C#: How can I solve "Collection was modified" in a BackgroundWorker progress report callback?

I've used BackgroundWorkers quite a bit, but I've never experienced this problem before. My program analyses the output from a logic analyser producing packets, of which there are thousands. To prevent too much delay updating the ListView in my form (I was previously reporting each one as it was found, and the form was completely unrespo...

How to print in a thread-safe manner in C/Cilk?

I am playing around with Cilk and I am having an issue with printing synchronously. Printing is slow, so it's hard to keep the prints synchronous. For example... void ftn(int x) { if (x % 2 == 0) { std::cout << "printing.. " << x << std::endl; } else { cilk_spawn ftn(x/2); cilk_spawn ftn(x++...

Multithread DNS Query against specific DNS, domain and recordtype supporting Library

Resolved, used adns with python bindings... I have a scenario in which i have to do the following: Load a domain Load what record type is to be queried Load list of DNS Perform query, fetch results and display them. I have tried this but its not multi threaded and even a single query takes about 3 seconds. I looked at ADNS, its pyth...

LowLevelMouseProc in background thread

I'm trying to setup mouse hook on background thread. delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam); LowLevelMouseProc _proc = HookCallback; SetWindowsHookEx(PInvoke.WH_MOUSE_LL, _proc, IntPtr.Zero, 0); and IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam){/**/} If I put this on the main windo...

How can I make my app more responsive?

Background This is the same background as my previous question, except the Outline view doesn't have a fetch predicate. I've got an NSOutlineView that shows TrainingGroup entities. The NSOutlineView is bound to an NSTreeController In the NSTreeController, I've got "Preserve Selection" ticked and "Select inserted objects" unticked. Ea...

c#: better threading architecture

Hello, I am interested to get some ideas from you about what would be a good/better threading architecture that respects the rules described below: A thread must be running for the life of the application, in the sleep/wait mode if there is no work in the queue to be performed. A thread must be of a BelowNormal priority (this eliminat...

java socket threads

hi. im trying to create a client server game using java sockets. i have a thread server which controls the logic of the game. i also have client threads that communicate with the server. i use multiple client handler threads to facilitate server to client communication. i use multiple threads to communicate with other client threads usin...

c#: what is a thread polling?

What does it mean when one says no polling is allowed when implimenting your thread solution since it's wasteful, it has latency and it's non-deterministic. Threads should not use polling to signal each other. EDIT Based on your answers so far, I believe my threading implementation (taken from: http://www.albahari.com/threading/part2.a...

Is Deadlock recovery possible in MultiThread programming ?

Process has some 10 threads and all 10 threads entered DEADLOCK state( assume all are waiting for Mutex variable ). How can you free process(threads) from DEADLOCK state ? . Is there any way to kill lower priority thread ?( in Multi process case we can kill lower priority process when all processes in deadlock state). Can we attach th...