]> git.saurik.com Git - wxWidgets.git/commitdiff
document Initialize/Shutdown()
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 30 Dec 2008 11:45:07 +0000 (11:45 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 30 Dec 2008 11:45:07 +0000 (11:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

interface/wx/socket.h

index d6cd5ccce9c1793d71914063c21ee179586b71a9..ef5450411edfde95ed5d4cf3eac475e9919a30cb 100644 (file)
@@ -619,12 +619,9 @@ enum
     defines all basic IO functionality.
 
     @note
-    (Workaround for implementation limitation for wxWidgets up to 2.5.x)
-    If you want to use sockets or derived classes such as wxFTP in a secondary
-    thread, call @b wxSocketBase::Initialize() (undocumented) from the main
-    thread before creating any sockets - in wxApp::OnInit() for example.
-    See http://wiki.wxwidgets.org/wiki.pl?WxSocket or
-    http://www.litwindow.com/knowhow/knowhow.html for more details.
+    When using wxSocket from multiple threads, even implicitly (e.g. by using
+    wxFTP or wxHTTP in another thread) you must initialize the sockets from the
+    main thread by calling Initialize() before creating the other ones.
 
     @beginEventTable{wxSocketEvent}
     @event{EVT_SOCKET(id, func)}
@@ -678,6 +675,34 @@ public:
     */
     bool Destroy();
 
+    /**
+        Perform the initialization needed in order to use the sockets.
+
+        This function is called from wxSocket constructor implicitly and so
+        normally doesn't need to be called explicitly. There is however one
+        important exception: as this function must be called from the main
+        (UI) thread, if you use wxSocket from multiple threads you must call
+        Initialize() from the main thread before creating wxSocket objects in
+        the other ones.
+
+        It is safe to call this function multiple times (only the first call
+        does anything) but you must call Shutdown() exactly once for every call
+        to Initialize().
+
+        @return
+            @true if the sockets can be used, @false if the initialization
+            failed and sockets are not available at all.
+     */
+    static bool Initialize();
+
+    /**
+        Shut down the sockets.
+
+        This function undoes the call to Initialize() and must be called after
+        every successful call to Initialize().
+     */
+    static void Shutdown();
+
     //@}