Original Post
I'm writing a server in C++ w/ MFC. Currently, I use a select call w/ a timeout inside a special "listen for connect attempts thread." I use an Event to check if the app requested a stop thread event. I use a select to detect socket activity. I use a timeout on the select call which allows me to go back and check for the stop thread event. In essence, I'm polling inside my thread. Is there a way around this? Normally, I would use a wait for multiple events call. However, I'm looking for socket activity in this case. Thanks in advance. while(bStop == false) { //check event status Event = WaitForSingleObject(m_hStopEvent, 0); switch(Event) { case WAIT_TIMEOUT: ...call select w/ a timeout break; case WAIT_OBJECT_0: bStop = true; break; } }