// --------- SocketWaiter ---------------------------------------
// --------------------------------------------------------------
+#if wxUSE_THREADS
SocketWaiter::SocketWaiter(wxSocketBase *socket,
wxSocketInternal *internal)
: m_socket(socket), m_internal(internal), m_fd(internal->GetFD())
}
return NULL;
}
+#endif
// --------------------------------------------------------------
// --------- wxSocketInternal -----------------------------------
wxSocketInternal::wxSocketInternal(wxSocketBase *socket)
{
m_socket = socket;
+#if wxUSE_THREADS
m_thread_requester = NULL;
m_thread_waiter = NULL;
m_invalid_requester = TRUE;
m_request_locker.Lock();
+#endif
}
wxSocketInternal::~wxSocketInternal()
{
+#if wxUSE_THREADS
StopRequester();
wxASSERT(m_thread_requester == NULL);
StopWaiter();
wxASSERT(m_thread_waiter == NULL);
m_request_locker.Unlock();
+#endif
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
SockRequest *wxSocketInternal::WaitForReq()
{
+#if wxUSE_THREADS
wxNode *node;
node = m_requests.First();
}
return (SockRequest *)node->Data();
+#else
+ return NULL;
+#endif
}
// ----------------------------------------------------------------------
void wxSocketInternal::AcquireFD()
{
+#if wxUSE_THREADS
m_fd_locker.Lock();
+#endif
}
void wxSocketInternal::ReleaseFD()
{
+#if wxUSE_THREADS
m_fd_locker.Unlock();
+#endif
}
void wxSocketInternal::ResumeRequester()
{
+#if wxUSE_THREADS
wxThreadError err;
wxASSERT(m_thread_requester == NULL);
m_invalid_requester = FALSE;
}
m_end_requester.Unlock();
+#endif
}
void wxSocketInternal::StopRequester()
{
+#if wxUSE_THREADS
if (m_invalid_requester) {
delete m_thread_requester;
m_thread_requester = NULL;
delete m_thread_requester;
m_thread_requester = NULL;
+#endif
}
void wxSocketInternal::ResumeWaiter()
{
+#if wxUSE_THREADS
wxThreadError err;
if (m_thread_waiter != NULL)
err = m_thread_waiter->Run();
wxASSERT(err == wxTHREAD_NO_ERROR);
+#endif
}
void wxSocketInternal::StopWaiter()
{
+#if wxUSE_THREADS
if (m_thread_waiter == NULL)
return;
delete m_thread_waiter;
m_thread_waiter = NULL;
+#endif
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
void wxSocketInternal::QueueRequest(SockRequest *request, bool async)
{
+#if wxUSE_THREADS
if (async) {
if (m_thread_requester == NULL)
ResumeRequester();
request->done = TRUE;
m_request_locker.Unlock();
}
+#endif
}
void wxSocketInternal::WaitForEnd(SockRequest *request)
{
+#if wxUSE_THREADS
// TODOTODO
+#endif
}
#endif