Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Events and Wait functions

Status
Not open for further replies.

teubenragee

Programmer
May 22, 2001
27
0
0
DE
Here is a little code:
HANDLE hThread;
...
hThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ThreadFunc,(LPVOID) Param,0,ThreadID);
...
void ThreadFunc(LPVOID Param)
HANDLE hEvent;
hEvent=CreateEvent(NULL,FALSE,FALSE,NULL);
ResetEvent(hEvent);
WaitForSingleObject(hEvent,INFINITE);
...

I never Set the hEvent object
and the thread is really running(I've checked this)
I checked the hEvent value : it is not INVALID_HANDLE_VALUE
I check the result of the Waiting function: it is WAIT_OBJECT_0
The thread goes through the wait function as if the Event was always set

Why?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top