Re: Message between threads
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Thu, 25 May 2006 15:14:56 -0700
I don't understand what in the world you're trying to accomplish. Sit down
with someone who knows multi-threaded code and explain to them what's
supposed to happen, then work out what the code should do to implement
that...
The SetEvent in the communication_thread is *never executed*. It's outside
the loop which runs forever. The same is true of the status event which is
never set in algorithm_thread...
Paul T.
"wceess" <wceess@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:493B468E-CBEC-4E1B-BE0E-5FA6C7A99F6D@xxxxxxxxxxxxxxxx
Hi paul,
Just curous to know what would happen in this code
DWORD communication_thread(LPVOID lpv)
{
short int j = 0;
while(TRUE)
{
EnterCriticalSection(&csObject1);
message.failure_status = FALSE;
messages.failure_id = 0;
LeaveCriticalSection(&csObject1);
Sleep(100);
}
SetEvent(communication_event);
return 0;
}
DWORD algorithm_thread(LPVOID lpv)
{
WaitForSingleObject(communication_event, 150); // auto reset
while (TRUE)
{
EnterCriticalSection(&csObject2);
important_data = i;
LeaveCriticalSection(&csObject2);
Sleep(1000);
}
SetEvent(status_event);
return 0;
}
Will the setevent in comm can make the alg to run even though if its in
sleep for 1000 or only after say roughly 10 times this will wake up the
alg.
THanks
.
- References:
- Re: Message between threads
- From: Paul G. Tobey [eMVP]
- Re: Message between threads
- From: Steve Maillet \(eMVP\)
- Re: Message between threads
- From: Paul G. Tobey [eMVP]
- Re: Message between threads
- From: wceess
- Re: Message between threads
- From: wceess
- Re: Message between threads
- From: Paul G. Tobey [eMVP]
- Re: Message between threads
- Prev by Date: Re: Message between threads
- Next by Date: Running Activesync on WinCE with S3C2410
- Previous by thread: Re: Message between threads
- Next by thread: Re: Message between threads
- Index(es):
Relevant Pages
|