multithreading

What object should a Monitor wait on?

When using Monitor.Wait(object obj) what should one use for the obj? In this article I'm reading on multithreading in .NET the author instantiates a new Object() to be used only as a monitor lock. Is this what you should do in practice, or is it more typical to Monitor the actual variable shared between two or more threads? ...

How do distributed transactions behave with multiple connections to the same DB in a threaded environment?

I’m trying to determine the behaviour of multiple database connection in a distributed transaction. I’ve got a long running process which spawns a series of threads and each thread is then responsible for managing its’ DB connections and such. All of this runs inside of the transaction scope and each thread is enlisted in the transacti...

How can I create a System Mutex in C#

How can I create a system/multiprocess Mutex to co-ordinate multiple processes using the same unmanaged resource. Background: I've written a procedure that uses a File printer, which can only be used by one process at a time. If I wanted to use it on multiple programs running on the computer, I'd need a way to synchronize this acros...

Manually Timing out a C# Thread

I have a need to add a timeout to a long running thread. We're having some external issues which can sometimes cause that thread to hang at a certain line of code indefinitely. To make our process more robust, we would like to detect that the thread is no longer actively running/polling and abort the thread. This would let us clean up ...

Singleton Implementation Works Fine on 32-bit but not 64-bit

I'm working on an application with a shared object that is accessed via a singleton. It's working fine on 32-bit however on 64-bit it doesn't appear to be locking properly. In the constructor for my object I have code that checks for some config reg keys and prompts the user if they don't exist. On 32 bit I see the prompt only once as ex...

Fix external library ThreadLocal leak in WebLogic 10

In a web application running in WebLogic, we are using a (commercial) library which doesn't free the ThreadLocal variables it uses. Each time a method in the library API is used, some Kbs of information are leaked in the Thread that processes the request. We are in the way of getting rid of the library but, in the meantime, we would lik...

How do I ensure another Thread's Handler is not null before calling it?

My program threw a NullPointerException the other day when it tried to use a Handler created on another thread to send that thread a message. The Handler created by the other thread was not yet created, or not yet visible to the calling thread, despite the calling thread having already called start on the other thread. This only happens ...

How to create a basic Java Server?

Essentially I want a basic Java Server which multiple people can be connected to and when one of the connected clients (Already coded in Obj-c) sends data to it, it sends it back to everyone who is connected. I'm a real Java Newbie and I'm not going to need Java in the forseeable future for anything but this so I want it out the way as ...

SimpleXMLRPCServer, wxPython and Thread - Howto Stop?

Here is an example program that illustrates my problem. The program starts a wxPython application and starts a SimpleXMLRPCServer in a thread. This all works fine. My problem is that I can't shut down the SimpleXMLRPCServer thread because it is blocked on the handle_request() call. I am developing on a Windows XP machine (I don't kno...

.Net Critical regions in threading not working as desired

Hi, I am trying to run a sample code (a very basic one) involving threading and critical regions. Here's my code: public static void DoCriticalWork(object o) { SomeClass instance = o as SomeClass; Thread.BeginCriticalRegion(); instance.IsValid = true; Thread.Sleep(2); ...

django csv import threading

Is it possible to use threading when importing data from csv files to django. ...

How to prevent writer starvation in a read write lock in pthreads

Hi, I have some questions regarding read write locks in POSIX Pthreads on a *nix system, say Linux for example. I wish to know what is the default bias for read write lock i.e does it prefer reads over writes or vice versa ? Does it provide some api to change this default behaviour. Does posix pthread provide some api so that we could...

Can Prism EventAggregator be used for threading needs?

Hi, I was looking at Prism EventAggregator and its' great. I part i was most concerned was its capability to marshal thread correctly to UI thread. I was wondering if i can use this capability to provide module developers a class which could be used to create threads in a similar way as BackgroundWorker. Interface of class can be some...

Looking for a C or C++ library providing a functionality similar to Google Go's channels

...for use in a multithreaded network server. I want to pass data around between multiple threads. Currently I'm using sockets, with the master thread blocking on select() and workers blocking on recv(), though I feel there probably are more advanced or prepackaged ways of handling this task in C++. ...

jetty configuration: what is "lowThreads"?

I'm writing a jetty configuration file, and I haven't been able to find information about a thread pooling parameter. My aim is to tune jetty for performance, and I would like to understand what the "lowThreads" item means for a ThreadPool object. Up to now, I've found that it's used to "set the low resource threads threshold", and tha...

Does the StuckThreadMaxTime parameter in Weblogic 10.3 aborts the thread ?

I get below message on application console when a some process takes unusually long time to complete. I am having doubt whether this message implies that my thread is aborted or can it continue after this ? <[STUCK] ExecuteThread: '0' for q ueue: 'weblogic.kernel.Default (self-tuning)' has been busy for "609" seconds working on...

Are there any static code analysis tools that look at potential execution paths that might lead to a deadlock(C#)

Is there any tool or plugin for visual studio (2008) that will go over a C# class and look for possible scenarios that could lead to potential deadlocks? Anything that would seek out every lock (xxx) {} block and then seek other methods that call the method leading to that critical section and forms a list of methods that could lead to a...

reference assignment is atomic so why is Interlocked.Exchange(ref Object, Object) needed?

In my multithreaded asmx web service I had a class field _allData of my own type SystemData which consists of few List<>s and Dictionary<>s marked as volatile. The system data (_allData) is refreshed once in a while and I do it by creating another object called newData and fill it's data structures with new data. When it's done I just as...

CoreData weird behavior when data are loaded on background thread

Hi there, I have very strange problem, when I don't understand what's going on at all, so I'm looking for explanation of it. Situation is as following: I have a view controller with scrollview with three subviews in it. Those three subviews have method -(void)loadContent which loads content from database using CoreData in the backg...

How to initialize a QT thread in python

As per examples seen online, I've created a Worker thread. I'm looking for a thread to run my GUI while one thread executes my code. Worker thread is defined as: class Worker(QThread): def __init__(self, parent = None): QThread.__init__(self, parent) self.exiting = False self.size = QSize(0, 0) def __...