Title: [161159] trunk/Source/_javascript_Core
Revision
161159
Author
[email protected]
Date
2013-12-30 16:30:11 -0800 (Mon, 30 Dec 2013)

Log Message

Stop using ThreadCondition in jsc.cpp
https://bugs.webkit.org/show_bug.cgi?id=126311

Reviewed by Sam Weinig.

* jsc.cpp:
(timeoutThreadMain):
(main):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (161158 => 161159)


--- trunk/Source/_javascript_Core/ChangeLog	2013-12-30 23:57:16 UTC (rev 161158)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-12-31 00:30:11 UTC (rev 161159)
@@ -1,5 +1,16 @@
 2013-12-30  Anders Carlsson  <[email protected]>
 
+        Stop using ThreadCondition in jsc.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=126311
+
+        Reviewed by Sam Weinig.
+
+        * jsc.cpp:
+        (timeoutThreadMain):
+        (main):
+
+2013-12-30  Anders Carlsson  <[email protected]>
+
         Replace WTF::ThreadingOnce with std::call_once
         https://bugs.webkit.org/show_bug.cgi?id=126215
 

Modified: trunk/Source/_javascript_Core/jsc.cpp (161158 => 161159)


--- trunk/Source/_javascript_Core/jsc.cpp	2013-12-30 23:57:16 UTC (rev 161158)
+++ trunk/Source/_javascript_Core/jsc.cpp	2013-12-31 00:30:11 UTC (rev 161159)
@@ -47,6 +47,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <thread>
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 #include <wtf/StringPrintStream.h>
@@ -549,17 +550,11 @@
 int jscmain(int argc, char** argv);
 
 static double s_desiredTimeout;
-static double s_timeToWake;
 
 static NO_RETURN_DUE_TO_CRASH void timeoutThreadMain(void*)
 {
-    // WTF doesn't provide for a portable sleep(), so we use the ThreadCondition, which
-    // is close enough.
-    Mutex mutex;
-    ThreadCondition condition;
-    mutex.lock();
-    while (currentTime() < s_timeToWake)
-        condition.timedWait(mutex, s_timeToWake);
+    auto timeout = std::chrono::microseconds(static_cast<std::chrono::microseconds::rep>(s_desiredTimeout * 1000000));
+    std::this_thread::sleep_for(timeout);
     
     dataLog("Timed out after ", s_desiredTimeout, " seconds!\n");
     CRASH();
@@ -616,10 +611,8 @@
             dataLog(
                 "WARNING: timeout string is malformed, got ", timeoutString,
                 " but expected a number. Not using a timeout.\n");
-        } else {
-            s_timeToWake = currentTime() + s_desiredTimeout;
+        } else
             createThread(timeoutThreadMain, 0, "jsc Timeout Thread");
-        }
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to