]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/socket.h
The object size page now has full position attribute editing.
[wxWidgets.git] / include / wx / socket.h
index e6b11b1f255f4f60fab40aa1f5d8cb4816bb882b..35370059e764d8a4679dae0e8c6ab5aa69f7dd3d 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        socket.h
+// Name:        wx/socket.h
 // Purpose:     Socket handling classes
 // Authors:     Guilhem Lavaux, Guillermo Rodriguez Garcia
 // Modified by:
 // Purpose:     Socket handling classes
 // Authors:     Guilhem Lavaux, Guillermo Rodriguez Garcia
 // Modified by:
@@ -179,11 +179,21 @@ public:
     void SetNotify(wxSocketEventFlags flags);
     void Notify(bool notify);
 
     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();
 
     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
     // --------------------------
 
     // Implementation from now on
     // --------------------------
@@ -264,9 +274,6 @@ private:
     wxSocketEventFlags  m_eventmask;  // which events to notify?
     wxSocketEventFlags  m_eventsgot;  // collects events received in OnRequest()
 
     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;
 
     friend class wxSocketReadGuard;
     friend class wxSocketWriteGuard;