Skip to main content
gamedev.net
🔒 Locked

Using Socket Select W/ a VC++ WaitForEvent

Started by fathom88 1 reply 1.2k views
Original Post
fathom88
fathom88
I have a socket read thread. I would like to be able just to wait for a stop signal to end the thread. However, I have to loop and check an event. while(bRun == true) { //check event status EventState = WaitForMultipleObjects(2, Events, FALSE,INFINITE); switch(EventState) { case WAIT_OBJECT_0: //stop event bRun = false; break; case (WAIT_OBJECT_0 + 1): //read on FD_ZERO(&fdset); FD_SET(Socket, &fdset); if(select(1, &fdset, NULL, NULL, &conn_timeout) > 0) { //read data.............. } break; } } I remember in UNIX you could wait for a signal at the select statement which worked in similar way to WaitForEvent. I want to wait at the select statement in an indefinite time instead of timing out and polling again when there is no activity. Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.