multithreading

Threading in Python

What's the best approach to writing multi-threaded applications in Python, I'm aware of the basic concurrency mechanisms provided by the language and also of Stackless Python. What would you recommend and why? ...

Java: Class entirely run in second thread / IllegalMonitorStateException

Hello When you want a certain task to be executed by another thread, you can extend Thread or implement Runnable. I've made an attempt to create a class which runs a class entirely in the second thread. This means that you can call anyMethod() which returns immediately and which is executed by the second thread. Here is my attempt:...

What could cause a long delay after reading events from WMI using Vb.Net

I have a windows user control that reads events from the application log of a remote server. I can read in the information alright, and it appears to happen very quickly, however the thread hangs up for about 30 seconds afterwards and keeps my application from displaying the log. I am afraid that this is probably caused by my lack of e...

Calling void methods in IIS 7 and not waiting for them to return

I'm on IIS7 I have a button on a page. When I click it, a new thread is started which calls a void method, which takes 20 to 30 minutes to complete. The problem is the called void method stops running as soon as control is returned to the browser. (At least it appears to) protected void _Build_Click(object sender, EventArgs e) ...

Does .NET have thread safe generic classes?

I have implemented my own RingBuffer, but I'm surprised to see that .NET does not have one. Or even a simply thread safe queue, list or collection? Why doesn't .NET contain thread safe classes? Are they planned for the future? ...

Cancel BeginInvoke in WPF

In WPF, I am calling This.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, mydelegete); Is there a way to cancel later that BeginInvoke method? Thanks ...

subprocess with timeout

In Python, I have a program snippet similar to the following that has the effect of running a custom command and returning the stdout data (or raise exception when exit code is non-zero): proc = subprocess.Popen( cmd, # keep stderr separate; or merge it with stdout (default). stderr=(subprocess.PIPE if ignore_stderr else sub...

Why might threads be considered "evil"?

I was reading the SQLite FAQ, and came upon this passage: Threads are evil. Avoid them. I don't quite understand the statement "Thread are evil". If that is true, then what is the alternative? My superficial understanding of threads is: Threads make concurrence happen. Otherwise, the CPU horsepower will be wasted, waiting for (...

Entity Framework with a game server

I have been looking into using the Entity Framework in my C# game server to make querying easier. I am a huge fan of type safety, and the Entity Framework does a great job at automating most of the boilerplate code. Though I am not quite sure how to go about utilizing some of the components, namely the ObjectContext. The server uses qui...

How to get details of Thread which posses a Lock on the object

Let us say that one Thread is executing inside a Synchronized Function in Java and another Thread wants to access the same method but it will have to wait till the first Thread completes. How can the second Thread know which Thread is having the Lock on the Object. I would want to print the details of the first Thread and possibly from w...

Cocoa: Checks required for multiple asynchronous NSURLConnections using same delegate functions?

This is with reference to the StackOverflow question Managing multiple asynchronous NSURLConnection connections I have multiple asynchronous HTTP requests being made at the same time. All these use the same NSURLConnection delegate functions. (The receivedData object is different for each connection as specified in the other question ab...

Multithreading in Uniprocessor

I wish to know how multi-threading in a uniprocessor system is helpful my doubt is when you create the thread it is going to take the execution time slice from the main thread only and other thing is scheduling of threads (context switch between the threads) will also takes considerable amount of time (preemptive kernel) and at a time p...

what happens when a Thread throws an Exception ?

If I invoke the run() method on a Thread and the run() method throws an uncaught Exception what would be the outcome ? Who catches this Exception ? Does it even get caught ? ...

How to see windows messages of a dialog shown with a second thread?

I've registered a message filter using Application.AddMessageFilter(m_messageFilter); using this I can log all of the mouse clicks a user makes in the application's user interface. However, one dialog is run on a separate thread, with code something like: void Run() { using( MyDialog dialog = new MyDialog() ) { dialo...

How to detect deadlock ? Timeout in synchronized block?

I’m debugging a Java application that runs several threads. After a while of watching the log it seems that one of those threads is not running anymore. My guess is that the thread is waiting for a lock that is never released (the last output is before calling a synchronized method). Can I configure a timeout to the thread; a sort of “...

Threadsafe java servlet

I need to know if there are any issues with the below code as far as threading goes. I was always under the impression that so long as class level variables are not used threading is not an issue. public class UploadReferralImage extends HttpServlet { String CLASS_NAME = "UploadReferralImage"; public void doGet(HttpServletRequest r...

Why am I getting a "Cross-thread operation not valid exception" in the callback method when using AsyncCallback with BeginInvoke?

I have a windows form that gets data from a scale via the serial port. Since I need the operator to be able to cancel the process I do the get data process on a second thread. The data collection process gets multiple readings from the scale one at a time. The form has a label that needs to be updated with information specific to each ...

C# ThreadStart with parameters

How is it possible to start a thread with parameters in C# ...

Theorectical Threading Question C#

I have a loop that could contain 1-10 records.... Inside that loop I am calling : ThreadStart processTaskThread = delegate { ProcessTasks(myParam ); }; new Thread(processTaskThread).Start(); My question is: Will this work, or do I somehow need to write the code, so that the threads are declared using unique variable names? ...

BackgroundWorker Thread used for Serial port data processing Throwing "This BackgroundWorker is currently busy and cannot run multiple tasks concurrently"

Hello Guys, I am developing a application in C# which is getting data from Serial Port, Processing it and showing it to UI. The data is coming very fast between 5-50ms speed. Before I was not using any threads. and so application was relying on single App thread which was getting data from Serial Port, Processing data and showing it to U...