no-socketts-deadlock
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 65 5674a3e586f318223a76af5d678101ee58d80805
permissions -rw-r--r--
State as of now

diff --git a/netwerk/base/src/nsSocketTransportService2.cpp b/netwerk/base/src/nsSocketTransportService2.cpp
--- a/netwerk/base/src/nsSocketTransportService2.cpp
+++ b/netwerk/base/src/nsSocketTransportService2.cpp
@@ -49,6 +49,7 @@
 #include "prlock.h"
 #include "prerror.h"
 #include "plstr.h"
+#include "nsXPCOMRequests.h"
 
 #if defined(PR_LOGGING)
 PRLogModuleInfo *gSocketTransportLog = nsnull;
@@ -320,16 +321,24 @@ nsSocketTransportService::Poll(PRBool wa
     if (!wait)
         pollTimeout = PR_INTERVAL_NO_WAIT;
 
-    PRIntervalTime ts = PR_IntervalNow();
-
-    LOG(("    timeout = %i milliseconds\n",
-         PR_IntervalToMilliseconds(pollTimeout)));
-    PRInt32 rv = PR_Poll(pollList, pollCount, pollTimeout);
-
-    PRIntervalTime passedInterval = PR_IntervalNow() - ts;
+    PRInt32 rv;
+    PRIntervalTime ts;
+    PRIntervalTime passedInterval;
+
+    {
+      nsAutoSuspendRequest req;
+
+      ts = PR_IntervalNow();
+
+      LOG(("    timeout = %i milliseconds\n",
+	   PR_IntervalToMilliseconds(pollTimeout)));
+      rv = PR_Poll(pollList, pollCount, pollTimeout);
+
+      passedInterval = PR_IntervalNow() - ts;
+    }
 
     LOG(("    ...returned after %i milliseconds\n",
-         PR_IntervalToMilliseconds(passedInterval))); 
+	 PR_IntervalToMilliseconds(passedInterval))); 
 
     *interval = PR_IntervalToSeconds(passedInterval);
     return rv;