}
}
-void SocketEvents::WakeUpThread(void)
+void SocketEvents::WakeUpThread(bool wait)
{
- if (boost::this_thread::get_id() != l_SocketIOThread.get_id()) {
- boost::mutex::scoped_lock lock(l_SocketIOMutex);
+ if (wait) {
+ if (boost::this_thread::get_id() != l_SocketIOThread.get_id()) {
+ boost::mutex::scoped_lock lock(l_SocketIOMutex);
- l_SocketIOFDChanged = true;
+ l_SocketIOFDChanged = true;
- (void) send(l_SocketIOEventFDs[1], "T", 1, 0);
+ (void) send(l_SocketIOEventFDs[1], "T", 1, 0);
- while (l_SocketIOFDChanged)
- l_SocketIOCV.wait(lock);
+ while (l_SocketIOFDChanged)
+ l_SocketIOCV.wait(lock);
+ }
+ } else {
+ (void) send(l_SocketIOEventFDs[1], "T", 1, 0);
}
}
m_FD = INVALID_SOCKET;
}
- WakeUpThread();
+ WakeUpThread(true);
}
void SocketEvents::ChangeEvents(int events)
static void InitializeThread(void);
static void ThreadProc(void);
- static void WakeUpThread(void);
+ static void WakeUpThread(bool wait = false);
int GetPollEvents(void) const;