// event
class WXDLLIMPEXP_FWD_NET wxSocketEvent;
-wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent);
// --------------------------------------------------------------------------
// wxSocketBase
void SetNotify(wxSocketEventFlags flags);
void Notify(bool notify);
- // initialize/shutdown the sockets (usually called automatically)
- static bool IsInitialized();
+ // initialize/shutdown the sockets (done automatically so there is no need
+ // to call these functions usually)
+ //
+ // should always be called from the main thread only so one of the cases
+ // where they should indeed be called explicitly is when the first wxSocket
+ // object in the application is created in a different thread
static bool Initialize();
static void Shutdown();
+ // check if wxSocket had been already initialized
+ //
+ // notice that this function should be only called from the main thread as
+ // otherwise it is inherently unsafe because Initialize/Shutdown() may be
+ // called concurrently with it in the main thread
+ static bool IsInitialized();
// Implementation from now on
// --------------------------
wxSocketEventFlags m_eventmask; // which events to notify?
wxSocketEventFlags m_eventsgot; // collects events received in OnRequest()
- // the initialization count, wxSocket is initialized if > 0
- static size_t m_countInit;
-
friend class wxSocketReadGuard;
friend class wxSocketWriteGuard;
- DECLARE_NO_COPY_CLASS(wxSocketBase)
+ wxDECLARE_NO_COPY_CLASS(wxSocketBase);
DECLARE_CLASS(wxSocketBase)
};
bool WaitForAccept(long seconds = -1, long milliseconds = 0);
- DECLARE_NO_COPY_CLASS(wxSocketServer)
+ wxDECLARE_NO_COPY_CLASS(wxSocketServer);
DECLARE_CLASS(wxSocketServer)
};
int m_initialRecvBufferSize;
int m_initialSendBufferSize;
- DECLARE_NO_COPY_CLASS(wxSocketClient)
+ wxDECLARE_NO_COPY_CLASS(wxSocketClient);
DECLARE_CLASS(wxSocketClient)
};
*/
private:
- DECLARE_NO_COPY_CLASS(wxDatagramSocket)
+ wxDECLARE_NO_COPY_CLASS(wxDatagramSocket);
DECLARE_CLASS(wxDatagramSocket)
};