Changeset 161159 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Dec 30, 2013, 4:30:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r160550 r161159 48 48 #include <stdlib.h> 49 49 #include <string.h> 50 #include <thread> 50 51 #include <wtf/CurrentTime.h> 51 52 #include <wtf/MainThread.h> … … 550 551 551 552 static double s_desiredTimeout; 552 static double s_timeToWake;553 553 554 554 static NO_RETURN_DUE_TO_CRASH void timeoutThreadMain(void*) 555 555 { 556 // WTF doesn't provide for a portable sleep(), so we use the ThreadCondition, which 557 // is close enough. 558 Mutex mutex; 559 ThreadCondition condition; 560 mutex.lock(); 561 while (currentTime() < s_timeToWake) 562 condition.timedWait(mutex, s_timeToWake); 556 auto timeout = std::chrono::microseconds(static_cast<std::chrono::microseconds::rep>(s_desiredTimeout * 1000000)); 557 std::this_thread::sleep_for(timeout); 563 558 564 559 dataLog("Timed out after ", s_desiredTimeout, " seconds!\n"); … … 617 612 "WARNING: timeout string is malformed, got ", timeoutString, 618 613 " but expected a number. Not using a timeout.\n"); 619 } else { 620 s_timeToWake = currentTime() + s_desiredTimeout; 614 } else 621 615 createThread(timeoutThreadMain, 0, "jsc Timeout Thread"); 622 }623 616 } 624 617 #endif
Note:
See TracChangeset
for help on using the changeset viewer.