[En-Nut-Discussion] Event API
Henk Kampman
henk at secondmove.com
Tue Oct 26 19:58:49 CEST 2004
Why is there no NutEventClear?
There are situations where another thread can complete and call
NutEventPost before you can call NutEventWaitNext.
The result is that NutEventWaitNext wil wait forever, because it wil
clear the already signaled event!
What you really need is something like this:
{
NutEventClear(&theEvent);
// issue some work to another thread and wait till completion
// StartAsyncRequest can yield to another thread!!
StartAsyncRequest();
NutEventWait(&theEvent,0);
}
instead of:
{
// issue some work to another thread and wait till completion
// StartAsyncRequest can yield to another thread!!
StartAsyncRequest();
// the following call will hang when the async task completes before
we reach NutEventWaitNext
NutEventWaitNext(&theEvent,0);
}
More information about the En-Nut-Discussion
mailing list