Re: SetEvent semantics (when nothing is waiting on the event)
- From: "Michel Verhagen (eMVP)" <michel@xxxxxxxxxx>
- Date: Wed, 21 May 2008 21:04:57 +1200
No, SetEvent will return immediately, but the state of an auto-reset event object remains signaled until a single waiting thread is released, at which time the system automatically sets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled.
Good luck,
Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog
GuruCE Ltd.
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.
rturner@xxxxxxxxxx wrote:
I've got a program that runs on WinCE 6.0. It uses an (auto-reset).
event to signal a thread to start processing data. The loop for this
data processing thread looks like:
while (!fExit)
{
WaitForSingleObject(hEvent);
DoSomeProcessing();
}
If I call SetEvent(hEvent) while the thread is busy inside
DoSomeProcessing(), my expectation is that SetEvent() would just set
hEvent to signalled, and then return. However, it appears that in
this case SetEvent() doesn't return until until it can actually set
one thread running, so it waits for the call to
WaitForSingleObject(hEvent) to be hit before it returns.
Can someone confirm this is how SetEvent on WinCE 6.0 works? Or
doesn't? This seems different that how SetEvent works on XP / Vista.
- Follow-Ups:
- Re: SetEvent semantics (when nothing is waiting on the event)
- From: Michel Verhagen (eMVP)
- Re: SetEvent semantics (when nothing is waiting on the event)
- References:
- Prev by Date: Serial Interrupt
- Next by Date: Re: SetEvent semantics (when nothing is waiting on the event)
- Previous by thread: SetEvent semantics (when nothing is waiting on the event)
- Next by thread: Re: SetEvent semantics (when nothing is waiting on the event)
- Index(es):