]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/http.cpp
don't force wxUSE_EXTENDED_RTTI to eb 1 for Borland compiler (why?)
[wxWidgets.git] / src / common / http.cpp
index 990e08e276729ae20cb70d06dc5e8e1f7c481a94..bea35a2335963372292749c054322afe58671b51 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#ifndef WX_PRECOMP
 #include "wx/string.h"
+#include "wx/app.h"
+#endif
+
 #include "wx/tokenzr.h"
 #include "wx/socket.h"
 #include "wx/protocol/protocol.h"
@@ -232,11 +237,10 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
     SetHeader(wxT("User-Agent"), wxT("wxWidgets 2.x"));
 
   SaveState();
-#if wxUSE_THREADS
-  SetFlags( wxThread::IsMain() ? wxSOCKET_NONE : wxSOCKET_BLOCK );
-#else
-  SetFlags( wxSOCKET_NONE );
-#endif
+
+  // we may use non blocking sockets only if we can dispatch events from them
+  SetFlags( wxIsMainThread() && wxApp::IsMainLoopRunning() ? wxSOCKET_NONE
+                                                           : wxSOCKET_BLOCK );
   Notify(false);
 
   wxString buf;