Title: [160959] trunk/Source
Revision
160959
Author
ander...@apple.com
Date
2013-12-20 21:23:10 -0800 (Fri, 20 Dec 2013)

Log Message

Replace yield() and pauseBriefly() with std::this_thread::yield()
https://bugs.webkit.org/show_bug.cgi?id=126105

Reviewed by Sam Weinig.

Source/WebCore:

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::interrupt):

Source/WTF:

* wtf/ByteSpinLock.h:
(WTF::ByteSpinLock::lock):
* wtf/Threading.h:
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
* wtf/ThreadingWin.cpp:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (160958 => 160959)


--- trunk/Source/WTF/ChangeLog	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WTF/ChangeLog	2013-12-21 05:23:10 UTC (rev 160959)
@@ -1,5 +1,19 @@
 2013-12-20  Anders Carlsson  <ander...@apple.com>
 
+        Replace yield() and pauseBriefly() with std::this_thread::yield()
+        https://bugs.webkit.org/show_bug.cgi?id=126105
+
+        Reviewed by Sam Weinig.
+
+        * wtf/ByteSpinLock.h:
+        (WTF::ByteSpinLock::lock):
+        * wtf/Threading.h:
+        * wtf/ThreadingPrimitives.h:
+        * wtf/ThreadingPthreads.cpp:
+        * wtf/ThreadingWin.cpp:
+
+2013-12-20  Anders Carlsson  <ander...@apple.com>
+
         Speed up case folding for 8-bit strings
         https://bugs.webkit.org/show_bug.cgi?id=126098
 

Modified: trunk/Source/WTF/wtf/ByteSpinLock.h (160958 => 160959)


--- trunk/Source/WTF/wtf/ByteSpinLock.h	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WTF/wtf/ByteSpinLock.h	2013-12-21 05:23:10 UTC (rev 160959)
@@ -26,11 +26,11 @@
 #ifndef ByteSpinLock_h
 #define ByteSpinLock_h
 
+#include <thread>
 #include <wtf/Assertions.h>
 #include <wtf/Atomics.h>
 #include <wtf/Locker.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/ThreadingPrimitives.h>
 
 namespace WTF {
 
@@ -45,7 +45,7 @@
     void lock()
     {
         while (!weakCompareAndSwap(&m_lock, 0, 1))
-            pauseBriefly();
+            std::this_thread::yield();
         memoryBarrierAfterLock();
     }
     

Modified: trunk/Source/WTF/wtf/Threading.h (160958 => 160959)


--- trunk/Source/WTF/wtf/Threading.h	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WTF/wtf/Threading.h	2013-12-21 05:23:10 UTC (rev 160959)
@@ -100,8 +100,6 @@
 WTF_EXPORT_PRIVATE int waitForThreadCompletion(ThreadIdentifier);
 WTF_EXPORT_PRIVATE void detachThread(ThreadIdentifier);
 
-WTF_EXPORT_PRIVATE void yield();
-
 WTF_EXPORT_PRIVATE void lockAtomicallyInitializedStaticMutex();
 WTF_EXPORT_PRIVATE void unlockAtomicallyInitializedStaticMutex();
 
@@ -112,6 +110,5 @@
 using WTF::currentThread;
 using WTF::detachThread;
 using WTF::waitForThreadCompletion;
-using WTF::yield;
 
 #endif // Threading_h

Modified: trunk/Source/WTF/wtf/ThreadingPrimitives.h (160958 => 160959)


--- trunk/Source/WTF/wtf/ThreadingPrimitives.h	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WTF/wtf/ThreadingPrimitives.h	2013-12-21 05:23:10 UTC (rev 160959)
@@ -130,22 +130,12 @@
 WTF_EXPORT_PRIVATE DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime);
 #endif
 
-inline void pauseBriefly()
-{
-#if OS(WINDOWS)
-    Sleep(0);
-#else
-    sched_yield();
-#endif
-}
-
 } // namespace WTF
 
 using WTF::Mutex;
 using WTF::MutexLocker;
 using WTF::MutexTryLocker;
 using WTF::ThreadCondition;
-using WTF::pauseBriefly;
 
 #if OS(WINDOWS)
 using WTF::absoluteTimeToWaitTimeoutInterval;

Modified: trunk/Source/WTF/wtf/ThreadingPthreads.cpp (160958 => 160959)


--- trunk/Source/WTF/wtf/ThreadingPthreads.cpp	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WTF/wtf/ThreadingPthreads.cpp	2013-12-21 05:23:10 UTC (rev 160959)
@@ -303,11 +303,6 @@
         threadMap().remove(threadID);
 }
 
-void yield()
-{
-    sched_yield();
-}
-
 ThreadIdentifier currentThread()
 {
     ThreadIdentifier id = ThreadIdentifierData::identifier();

Modified: trunk/Source/WTF/wtf/ThreadingWin.cpp (160958 => 160959)


--- trunk/Source/WTF/wtf/ThreadingWin.cpp	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WTF/wtf/ThreadingWin.cpp	2013-12-21 05:23:10 UTC (rev 160959)
@@ -284,11 +284,6 @@
     clearThreadHandleForIdentifier(threadID);
 }
 
-void yield()
-{
-    ::Sleep(1);
-}
-
 ThreadIdentifier currentThread()
 {
     return static_cast<ThreadIdentifier>(GetCurrentThreadId());

Modified: trunk/Source/WebCore/ChangeLog (160958 => 160959)


--- trunk/Source/WebCore/ChangeLog	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WebCore/ChangeLog	2013-12-21 05:23:10 UTC (rev 160959)
@@ -1,3 +1,13 @@
+2013-12-20  Anders Carlsson  <ander...@apple.com>
+
+        Replace yield() and pauseBriefly() with std::this_thread::yield()
+        https://bugs.webkit.org/show_bug.cgi?id=126105
+
+        Reviewed by Sam Weinig.
+
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::interrupt):
+
 2013-12-20  Ryosuke Niwa  <rn...@webkit.org>
 
         Assert that RootInlineBox::setLineBreakInfo should is never called on a RenderInline without line boxes

Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (160958 => 160959)


--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2013-12-21 04:58:15 UTC (rev 160958)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2013-12-21 05:23:10 UTC (rev 160959)
@@ -32,6 +32,7 @@
 #include "SQLiteFileSystem.h"
 #include "SQLiteStatement.h"
 #include <sqlite3.h>
+#include <thread>
 #include <wtf/Threading.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
@@ -140,7 +141,7 @@
         if (!m_db)
             return;
         sqlite3_interrupt(m_db);
-        yield();
+        std::this_thread::yield();
     }
 
     m_lockingMutex.unlock();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to