I have a program with a GUI that needs to open a separate window and wait for the user to select and option, then continue. I figure I should be doing this with the wait() and notify() methods, but I'm still trying to figure out exactly how to use those. A complicating factor is that things seem to work differently when the second window...
I'm using asio synchronous sockets to read data over TCP from a background thread. This is encapsulated in a "server" class.
However, I want the thread to exit when the destructor of this class is called.
The problem is that a call to any of the read functions does block, so the thread cannot be easily terminated. In Win32 there is an A...
I'm including the netinet headers and doing some raw socket programming on the iPhone, and have found when making these calls, the UI won't refresh until I'm finished- any response I get and write to the UI, isn't written until the IBAction that made the call is complete. Using performSelector with a delay, I've been able to work around ...
Is there a C# equivalent to Java's CountDownLatch?
...
Hi,
Could someone please help me with synchronizing varied number of threads? The problem is when the number of threads can vary from one to 9 and when for instance two clients are connected to server, the communication should be synchronized in this form : client1, client2, client1, client2 ... until the communication is over.
I tried ...
Hello ALL,
i have some python proxy checker.
and to speed up check, i was decided change to multithreaded version,
and thread module is first for me, i was tried several times to convert to thread version
and look for many info, but it not so much easy for novice python programmer.
if anyone can help me really much appreciate!!
th...
Can you suggest an approach when design-time components can be accessed both from general code (VCL or other) and from my own threads?
The problem is that when I have full control over my own threads I know exactly when I should access mutexes. In case of design-time elements I have no control at least of the code related to VCL.
One o...
I have a queue in which I can enqueue different threads, so I can assure two things:
Request are processed one by one.
Request are processed in the arriving order
Second point is important. Otherwise a simple critical section would be enough.
I have different groups of requests and only inside a single group these points must be ful...
I'm looking for a fast and efficient implementation of a Semaphore for the .NET Compact Framework. There has been another Question here on SO (Semaphores in .NET compact framework) in which it was suggested to use P/Invoke, but this is not possible in the XNA Framework running on the XBox 360.
I can offer two implementations of my own, ...
I need an answer to the following question to help understand what approach I should be taking to interface with Erlang. AFAIK Erlang on a SMP UNIX box uses the multi-process approach. In this case it should do same machine IPC.
Does Erlang use UNIX domain sockets for UNIX ?
Does it use named-pipes for windows ?
If it does not implem...
Does anyone have any books written for .net that deal with multithreading? I've looked at Joe Duffy's and Joseph Albahari's books, and they're good. I was hoping however, to have something that also touches on PLINQ and TPL, which Duffy's book certainly does, but many of its examples and snippets are in C++. I was ideally looking for ...
Parallel.ForEach Not Spinning Up New Threads
Hello all, we have a very IO-intensive operation that we wrote using Parallel.ForEach from Microsoft's Parallel Extensions for the .NET Framework. We need to delete a large number of files, and we represent the files to be deleted as a list of lists. Each nested list has 1000 messages in it...
I have a strange bug in a multithreaded app:
public class MyClass
{
private readonly Hashtable HashPrefs;
public MyClass(int id)
{
HashPrefs = new Hashtable();
}
public void SomeMethodCalledFromAnotherThread(string hashKey,string hashValue)
{
if (HashPrefs.Contains(hashKey)) // <-- throws NullReferenceException
...
The documentation for RegisterWaitForSingleObject says
Using a Mutex for waitObject does not
provide mutual exclusion for the
callbacks because the underlying Win32
API uses the default WT_EXECUTEDEFAULT
flag, so each callback is dispatched
on a separate thread pool thread.
Instead of a Mutex, use a Semaphore
with a max...
I have spent the whole day trying to make my application use threads but with no luck. I have read much documentation about it and I still get lots of errors, so I hope you can help me.
I have one big time consuming method which calls the database and updates the GUI. This has to happen all the time(or about every 30 seconds).
public c...
I'm trying to come up with some programming puzzles focused on multi-threading. Most of the problems I've been able to come up with, so far, have been pretty domain specific. Does anybody have any decent programming puzzles for developers attempting to learn the core concepts of multi-threading applications?
...
I have a TThread which receives and sends to a device on a COM port. After I read the data, I want to activate the GUI (not in the same thread) using Synchronize(function name). However, when I call the GUI's form function to perform a button click, I get an access violation. I checked to see if the form's value is null and it is not, si...
I'm currently working on a daemon that will be doing A LOT of different tasks. It's multi threaded and is being built to handle almost any kind of internal-error without crashing. Well I'm getting to the point of handling a shutdown request and I'm not sure how I should go about doing it.
I have a shutdown hook setup, and when it's call...
I need to be able to let multiple instances of the same form be open as my application can be used in different places at once. On the other hand i need to be able to process the operations during the "OK" event one at a time to ensure data is stored safely and not overwritten by another form instance by accident.
I show my form using t...
#include<pthread.h>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define NUM_THREADS 8
char *messages[NUM_THREADS];
struct thread_data
{
int thread_id;
int sum;
char *message;
};
struct thread_data thread_data_array[NUM_THREADS];
void *PrintHello(void *threadarg)
{
int taskid, sum;
char *hello_msg;
struct ...