I've recently seen the light of EventWaitHandle's powerful behavior in C# and decided to move some functionality in a sister application to do the same. The only problem is that the sister app is written in C.
No big deal, I'm using pthreads, which have a pthread_cond_t datatype that allows for signalling. My only question is, is it pos...
Just as in title. Is suspect it is, but I couldn't find it anywhere explicitly stated. And for this property I wouldn't like to rely on speculations.
...
I believe any programmer who has been dealing with database requests in a gui application has run into some or all of the following problems:
Your GUI freezes because you call
database layer from within the event
dispatch thread
When you have multiple windows/panels/jframes where user can start a db request your performance degrades be...
Hello,
let's say we have a c++ class like:
class MyClass
{
void processArray( <an array of 255 integers> )
{
int i ;
for (i=0;i<255;i++)
{
// do something with values in the array
}
}
}
and one instance of the class like:
MyClass myInstance ;
and 2 threads which call the processArray method o...
Greetings.
I'm trying to implement some multithreaded code in an application. The purpose of this code is to validate items that the database gives it. Validation can take quite a while (a few hundred ms to a few seconds), so this process needs to be forked off into its own thread for each item.
The database may give it 20 or 30 items ...
I have been trying to learn multithreaded programming in C# and am confused about when it is best to use the thread pool vs. create my own threads. One book recommended using the thread pool for small tasks only (whatever that means), but I can't seem to find any real guidelines. What are some considerations you use when making this pr...
What is the maximum number of threads you can create in a C# application? And what happens when you reach this limit? Is an exception of some kind thrown?
...
I'd like to get uniform distribution in range [0.0, 1.0)
If possible, please let the implementation make use of random bytes from /dev/urandom.
It would also be nice if your solution was thread-safe. If you're not sure, please indicate that.
See some solution I thought about after reading other answers.
...
I have a method which should be executed in an exclusive fashion. Basically, it's a multi threaded application where the method is invoked periodically by a timer, but which could also be manually triggered by a user action.
Let's take an example :
The timer elapses, so the method is
called. The task could take a few
seconds.
Right af...
I am currently getting exceptions when modifying an IBindingList on multiple threads. Does anyone have a threadsafe version before I write my own?
...
Hey I'm writing a windows forms application which is supposed to play a three sound files and at the end of each sound file it's to change the source of an image.
I can get it to play the sounds using System.Media.SoundPlayer. However it seems to play the sound in a different thread, continuing on.
The net effect of this is that only t...
Are there any templates/patterns/guides I can follow for designing a multithreaded server? I can't find anything terribly useful online through my google searches.
My program will start a thread to listen for connections using TcpListener.
Every client connection will be handled by it's own IClientHandler thread. The server will wrap ...
I have a winforms application, the issue has to do with threading.
Since I am calling 'MyCustomCode() which creates a new thread, and calls the method
'SomeMethod()' which then accesses MessageBox.Show(...).
The problem has to do with threading, since the newly created thread is trying to access
a control that was created on another th...
In a C++ Linux app, what is the simplest way to get the functionality that the Interlocked functions on Win32 provide? Specifically, a lightweight way to atomically increment or add 32 or 64 bit integers?
...
It's helpful to name threads so one can sort out which threads are doing what for diagnostic and debugging purposes.
Is there a particular naming convention for threads in a heavily multi-threaded application that works better than another? Any guidelines? What kind of information should go into the name for a thread? What have you lear...
The MSDN states that the method returns
true if the method is successfully
queued; NotSupportedException is
thrown if the work item is not queued.
For testing purposes how to get the method to return false? Or it is just a "suboptimal" class design?
...
Note: The code in this question is part of deSleeper if you want the full source.
One of the things I wanted out of commands was a baked design for asynchronous operations. I wanted the button pressed to disable while the command was executing, and come back when complete. I wanted the actual work to be performed in a ThreadPool work ...
Hi, just curious to know which CPU architectures support compare and swap atomic primitives?
...
I'd like to document what high-level (i.e. C++ not inline assembler ) functions or macros are available for Compare And Swap (CAS) atomic primitives...
E.g., WIN32 on x86 has a family of functions _InterlockedCompareExchange in the <_intrin.h> header.
...
I fill a collection one single time when my J2EE webapp starts.
Then, several thread may access it at same time but only to read it.
I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels read ?
...