multithreading

Choosing granularity with QtConcurrent

I'm looking to use QtConcurrent with a program having two or three levels of possible parallelism. At the highest level, a function L1() is called several times. The function L1() calls a function L2() several times, and the function L2() calls a function L3() several times. The bulk of the total running time is spent in L3(). The e...

Task launched from a Threading.Timer

Edit: Another note: This bug locks up my entire system and kills all open connections (web browser, database connections). Basically a system wide lock up until I do "end program" on the console app. Edit: Yet another note. I am currently running the code on 3 other machines. 1 is a compiled application, the other two are running from...

Need help with weird Begin/EndInvoke issue which Causes "Thread Leak"

I got following code executing at a ~1000ms rate. Left alone, it causes a weird "thread leak". Using WindDBG/SoS I am able to see waaay to many ThreadPool Worker threads (some of them are marked as dead) and eventually I will get a AccessVioalation Exception. Can anybody tell me if my BeginInvoke/EndInvoke use is wrong, unnecessary lock ...

cross-thread operation even when executing on UI thread

I have a function which adds a control to a parent control which is called from threads different to the thread the controls were created on. This is how it goes: 1 delegate void AddControlToParentDelegate(Control child, Control parent); 2 private void addControlToParent(Control child, Control parent) { 3 if (parent...

Help me solve this Threading issue with GPS

I have a GPS class which i obviously use to acquire the latitudes and longitudes. The UpdateData() is called when the gps state or location is changed. So i make sure that both the Latitude and Longitude is valid and then i make the DataReady bool equal to true. So i use this code in a fairly n00b fashion where i use a Timer (Windows ...

Session and threads

Not been able to find a definitive answer to this, when a client session is established to an ASP.NET MVC2 application I assume a particular thread from a thread pool handles that request. Does the same thread always handle all subsequent requests for that session? So in theory if somehow the session id were messed up and the wrong thr...

how to start new thread as soon as previously thread gets finished?

i have to develop windows service which will copy files to different servers. So i have to do this task using multi-theading. But i have to start only 3-4 threads. So whenever one threads get finished then i have to start new thread so that count of thread should remain 3 or 4. So how could i apply check on that ? please provide some inf...

Thread priority level

To make an application in Java under Linux with threads if I wanted to set a priority level which are min and max values? In Windows the ranges goes form 0 (lowest) to 31 (highest). ...

Howto close a specific 16 Bit thread of ntvdm.exe in Visual Basic?

There are running several threads of ntvdm.exe and want to close one of them. Thanks for your help! ...

Java 6 Threading output is not Asynchronous ?

This code should produce even and uneven output because there is no synchronized on any methods. Yet the output on my JVM is always even. I am really confused as this example comes straight out of Doug Lea. public class TestMethod implements Runnable { private int index = 0; public void testThisMethod() { index++; ...

Why do threads share the heap space?

Threads each have their own stack, but they share a common heap. Its clear to everyone that stack is for local/method variables & heap is for instance/class variables. What is the benefit of sharing heap among threads. There are several number of threads running simultaneously, so sharing memory can lead to issues such as concurrent m...

Python: Thread safe dictionary with short lived keys, is this correct?

import threading import weakref _mainlock = threading.RLock() _job_locks = weakref.WeakValueDictionary() def do_thing(job_id): _mainlock.acquire() #Dictionary modification lock acquire _job_locks.setdefault(job_id, threading.RLock()) #Possibly modifies the dictionary _mainlock.release() _job_locks[job_id].acquire() tr...

Mutex locks vs Threading locks. Which to use?

hello all. My main question is does the Threading lock object create atomic locks? It doesn't say that the lock is atomic in the module documentation. in pythons mutex documentation it does say the mutex lock is atomic but it seems that I read somewhere that in fact it isn't. I am wondering if someone could could give me a bit of insight...

Is there any possibility of two asynchronous Javascript function instances executing two blocks of code at the same time?

I understand that Javascript doesn't have multiple threads, but I'd like to know if the following code has any chance of breaking. My understanding is that unless an asynchronous function is called, such as setTimeout or an AJAX call, that once a block of code starts executing there's no way for it to pause until it completes or does ca...

Ruby: Threading and sockets.

I'm trying to write a server connection in Ruby that will spawn a thread to handle incoming connections. This thread will then interpret the incoming data, then place some instructions in a queue to be processed by the main program loop at its convenience. However, I seem to have some issues with the queue processing, as the program se...

Socket client/server input/output polling vs. read/write in linux

Basically I set up a test to see which method is the fastest way to get data from another computer my network for a server with only a few clients(10 at max, 1 at min). I tried two methods, both were done in a thread/per client fashion, and looped the read 10000 times. I timed the loop from the creation of the threads to the joining of ...

Parallel Processes In User Runtime Environment

I have a C++ program that allows a user to single step through processor instructions as a processor simulator emulates a MIPS processor. The problem is that, at least in my testing stages, I need to initialize ~2^32 integers to 0xDEADBEEF. I do this at start-up. It isn't extremely important that this happens completely before I start...

Am I deadlocking? Why?

I have a Silverlight 3 application which needs to call WCF service. The WCF service in turn calls an ASMX web service. When the WCF service call completes, the silverlight UI needs to be updated. WCF is being called in async. The thing is that the Silverlight app needs to call the WCF method(which later calls asmx internally) hundreds ...

How do I make my component entity system thread safe?

I am currently integrating an entity component system, as seen here, with a physics engine and a graphics engine. This was all fine until recently deciding that the physics should be running in its own thread. (Thanks Glenn Fiedler!) As it is now I am simply locking a mutex shared by all subsystems when accessing components. Snippet fr...

iPhone accessing one resource by two threads

hi, I want to synchronize one queue among two threads. Such as one thread performs enqueue and other performs dequeue. Any ideas?? ...