multithreading

How can I have one thread send an SQL query, and another wait for the results?

I have a program that does a limited form of multithreading. It is written in Delphi, and uses libmysql.dll (the C API) to access a MySQL server. The program must process a long list of records, taking ~0.1s per record. Think of it as one big loop. All database access is done by worker threads which either prefetch the next records o...

How to prevent PyQt objects from garbage collecting from different thread?

...

Multi-threading problem when checking the list Count property

Hi All, I have List newJobs. Some threads add items to that list and other thread removes items from it, if it's not empty. I have ManualResetEvent newJobEvent which is set when items are added to the list, and reset when items are removed from it: Adding items to the list is performed in the following way: lock(syncLock){ newJobs...

intellij- pause a thread while debugging

Can I pause a thread while debugging on intellij? What I want to have is something similiar to other ID - right click on a thread and pause it. ...

Will this code leak memory?

I am calling in applicationDidFinishLaunching: [self performSelectorInBackground:@selector(performReachabilityCheck) withObject:nil]; Here is the performReachabilityCheck -(void)performReachabilityCheck{ internetReach = [[Reachability reachabilityForInternetConnection] retain]; [internetReach startNotifer]; [self updateInt...

POSIX Threads behaviour different between HP-UX and Solaris 10

Hello all! I'm migrating a multi threaded application from HP-UX to Solaris and so far, everything is OK except for one thing! The application has a thread that is handling the signals and, when some of them are received, it runs some cleaning (logging, kill child processes and so on). I've reduced the code as much as it was possible t...

Thread safe queue (list) in .net

I need to create a thread safe list of items to be added to a lucene index. Is the following thread safe? public sealed class IndexQueue { static readonly IndexQueue instance = new IndexQueue(); private List<string> items = new List<string>(); private IndexQueue() { } public static IndexQueue Instance { get { ...

Java Thread Wait-Notify

I have 3 threads (A, B, C) that i just can't make them work how i want them to. ALL these 3 threads share a reference to the same object - K. What i'm trying to do, is to start all 3 up, then at some point in time when thread A arrives in a certain state, pause threads B and C, until A executes some method work() and when work finishes, ...

SQL Server and threads

Does a JOIN query under SQL Server always spawn an new thread? In general how does SQL Server control thread spawning? Thanks, -peter ...

Looking for a graphical explanation of boost threading.

As I read into threading, I'm starting to see a lot of really helpful diagrams that look like these: I was wondering if any of you know of a repository of such images that describe the functionality of the boost threading objects, idioms, potential pitfalls, etc. The most helpful diagram that I can envision would look something like...

Strange SEGFAULTS using fprintf

I'm having a very tough time debugging a multi-threaded C application that I've made a few changes to. I've been unable to use GDB to help identify the issue(see below code for more info). The following code is from one of the tasks that is opened in its own thread. I've snipped out most of the code following the problem. void tskPr...

"Simple" C# Time Thread Appears to be Freezing

I've been staring at this thread for some time and I believe my mind has shut down on it. Thinking that the best thing to do, in order to update the time in a UI TextBox, would be to create what I thought would be a simple thread to get the time and post it back to the UI control. After having fought with it for a while, I'm getting fr...

How to retrieve a value that must be computed on another thread

There are many cases where thread A requires a value that must be computed on thread B. (Most commonly, B == EDT.) Consider this example: String host; SwingUtilities.invokeAndWait(new Runnable() { public void run() { host = JOptionPane.showInputDialog("Enter host name: "); } }); openConnection(host); Of course, this ...

Mutex lock: what does "blocking" mean?

I've been reading up on multithreading and shared resources access and one of the many (for me) new concepts is the mutex lock. What I can't seem to find out is what is actually happening to the thread that finds a "critical section" is locked. It says in many places that the thread gets "blocked", but what does that mean? Is it suspende...

Updating global variables from a single worker thread: Do I need mutexes?

It seems that this question gets asked frequently, but I am not coming to any definitive conclusion. I need a little help on determining whether or not I should (or must!) implement locking code when accessing/modifying global variables when I have: global variables defined at file scope a single "worker" thread reading/writing to glob...

What's the right pattern for creating asyncronous services?

Here's what I'm trying to do: public class EmployeeService { public void GetEmployeesAsyc(Action<IEnumerable<Employees>> callback) { ThreadPool.QueueUserWorkItem(x => { var employees = //...fetch employees ...// callback(employees); }); } } public class ViewModel { private Emplo...

Can GDB display a list of pthread mutexes held by each thread?

I have GDB attached to a deadlocked application written with pthreads. There are ~10 threads that are all blocked, and I'd like to know which locks are held by which threads. This is possible in WinDbg using SOS.dll; is this possible in GDB? ...

What are the advantages of using an ExecutorService?

What is the advantage of using ExecutorService over running threads passing a Runnable into the Thread constructor? ...

Multi threaded client server

Hi I am working on an assignment writing multi threaded client server. So far I have done is open a socket in a port and forked two thread for listening and writing to client. But I need to connect two type of clients to the server and service them differently. My question is what would be my best approach? I am handling connection in a...

Close the process/program automatically in 10 min using C#/VC++?

I have one Windows Service/Application running silently on the PC, when user starts any program , i need to count the time and close it down (program) in 15 Minutes. Even when the user close down the particular program ( say winword.exe) with in 15 min, and reopen it... the program should automatically close on 15 th minute... ...