Signalling event
Main thread
{
//Create an eventin the non signalled mode and wait for it
HANDLE g_Event =CreateEvent(0,0,0,0);
//this method will wait till the event is Signalled
WaitForSingleObject(g_Event,INFINITE) ;
}
In another thread
{
//Set the event to signelled state, so that waitforsingle object can return
SetEvent(g_Event)
}
{
//Create an eventin the non signalled mode and wait for it
HANDLE g_Event =CreateEvent(0,0,0,0);
//this method will wait till the event is Signalled
WaitForSingleObject(g_Event,INFINITE) ;
}
In another thread
{
//Set the event to signelled state, so that waitforsingle object can return
SetEvent(g_Event)
}
Comments