multithreading

Are there any problems with having a group of win forms in one thread and another group in another thread?

I have an application that has two distinct groups of win forms and I want each group to operate in separate threads. Are there any problems with this approach as long as I BeginInvoke/Invoke when operations happen across the different threads? This question stems from the fact that I've always been used to thinking in terms of a 'gui ...

parallel process in wpf

Here is my scenario: I have a Main ParentWindow . Before opening the parent i would like to open a progressWindow and fetch the data from DB displaying this window. After the data fetch is complete i would like to close the progressWindow by using a delegate and i am running into threading issues. Just wondering if you have any suggesti...

Unable to read from the Socket Input Stream in a multithreaded environment with wait and notify

I am using 2 threads- ReaderThread for reading from the Socket input stream and the WriterThread for writing to the socket output stream. Both of them work fine when am just writing to the stream and not reading from the stream. But when am also Reading from the input stream the program doesn't run further, it hangs. Below is the code ...

Deadlock in Single threaded application.

Can a single threaded application have a deadlock? If so, please provide an example. ...

[Linux] Tracing pthread scheduling

Hi, What I want to do is create some kind of graph detailing the execution of (two) threads in Linux. I don't need to see what the threads do, just when they are scheduled and for how long, a time line basically. I've spend the last few hours searching the internet for a way to trace the scheduling of pthreads. Unfortunately, the two p...

Signal handling in Python

In my program I have a bunch of threads running and I'm trying to interrupt the main thread to get it to do something asynchronously. So I set up a handler and send the main process a SIGUSR1 - see the code below: def SigUSR1Handler(signum, frame): self._logger.debug('Received SIGUSR1') return signal.signal(signal.SIGUSR1, Si...

Method sleep until event fired

Hi, I have a poker framework for which I am trying to develop a "player" for. Basically I am implementing an object that implements a Player interface defined by the framework. I am trying to put a GUI on top of this player, the way that game play works is that the Dealer invokes the act() method on my player and expects a return type o...

Java thread interrupts and joins (thread is still alive after join)

Hi all, trying to figure out some behavior. I've got some code that spawns one thread. It waits some amount of time, and then interrupts it, joins it and then exits the method. . . . try { Thread.sleep(processForMillis); } catch (InterruptedException ex) { // Won't happen, ignore. } for (Thread t : thre...

is this a correct use of boost condition variables?

Hi Everyone, I wrote the following program for alternatively incrementing and doubling a counter(increment first) using boost condition variables. Can any one tell me if this is the correct use of boost condition variables. It is working correctly. I don't understand the use of lock in wait function call. What does condition.wait(lock) m...

How to deal with Concurrency before you start coding

I'm midway through programming a Java program, and I'm at the stage where I'm debugging far more concurrency issues than I'd like to be dealing with. I have to ask: how do you deal with concurrency issues when setting out your program mentally? In my case, it's for a relatively simple game, yet issues with threads keep popping up - any ...

Swing "blocking", I think I need to thread, but not sure how much

I have a little java app to effectively "tail" an arbitrary collection of files defined in an ini file. My "LogReader" class extends JFrame, and does the heavy lifting; reading the collection of file paths into a vector, and then iterating over the vector, reading each file and adding the last X lines of each to a text areas on the tabs ...

Pure Virtual Method Called

EDIT: SOLVED I'm working on a multi-threaded project right now where I have a base worker class, with varying worker classes that inherit from it. At runtime, the worker classes become threads, which then perform work as needed. Now, I have a Director I've written which is supposed to maintain an array of pointers to all of the workers...

Java Threads and MySQL

Hello all, I have a threaded chat server application which requires MySQL authencation. Is the best way to have 1 class create the MySQL connection, keep that connection open and let every thread use that connection but use own Query handler? Or is it better to have all threads make a seperate connection to MySQL to authencate? Or i...

Singleton's stateless instance method thread safety (C#)

Is it thread safe to make Converter a singleton? public interface IConverter<TFoo, TBar> where TFoo : class, new() where TBar : class, new() { TFoo ToFoo(TBar q); TBar ToBar(TFoo q); } public class Converter : IConverter<Foo, Bar> { public Foo ToFoo(Bar b) {return new Foo(b);} public Bar ToBar(Foo f) {return new...

Single thread to multi-threaded application

When we should use threads in our application. In other words, when should I convert a single threaded application to multi-threaded application. Being a developer, I think the task which is preventing to your application to run smoothly. That task can be handled by a thread. Like we are the getting GPS data Continuously. I think, there ...

Profiling thread sync lock contention.

In the past I've used performance profiling tools such as nprof, Equatec profiler and Yourkit profiler to identify and remove/reduce performance bottlenecks in code mostly running in one thread (serialized execution). Nowadays I write a lot of multi-threaded code which can be slowed down by lock contention; what tools and tricks can be u...

Mutithreading thread control

Hello everyone, How do I control the number of threads that my program is working on? I have a program that is now ready for mutithreading but one problem is that the program is extremely memory intensive and i have to limit the number of threads running so that i don't run out of ram. The main program goes through and creates a whol...

PThread vs boost::thread?

Having no experience with threading in the past, which threading technique in C++ will be the easiest for a beginner? boost::thread or pthreads? ...

Bounded Queue scenario

I need to implement a producer/consumer bounded queue, multiple consumers against a single producer. I have a push function that adds an item to the queue and then checks for maxsize. If we have reached it return false, in every other case return true. In the following code _vector is a List<T>, onSignal basically consumes an item in a...

inter thread communication in java

How do threads that rely on one another communicate in Java? For example, I am building a web crawler with threads that need data that comes from other threads. ...