[WTF] Improve a ParkingLot::parkConditionally() comment for a libstdc++ workaround
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Aug 2015 15:59:13 +0000 (15:59 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Aug 2015 15:59:13 +0000 (15:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148571

Reviewed by Filip Pizlo.

* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionally): Adjust the comment about the workaround for
the libstdc++ std::condition_variable implementation, linking to the WebKit bug
that dissected the problem and the GCC bug that originally reported the problem.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189151 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/ParkingLot.cpp

index c0e5f6e..adc547d 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-29  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WTF] Improve a ParkingLot::parkConditionally() comment for a libstdc++ workaround
+        https://bugs.webkit.org/show_bug.cgi?id=148571
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/ParkingLot.cpp:
+        (WTF::ParkingLot::parkConditionally): Adjust the comment about the workaround for
+        the libstdc++ std::condition_variable implementation, linking to the WebKit bug
+        that dissected the problem and the GCC bug that originally reported the problem.
+
 2015-08-28  Anders Carlsson  <andersca@apple.com>
 
         Remove the #if PLATFORM(MAC) in DeprecatedSymbolsUsedBySafari.mm so we'll actually build it on iOS.
index 1bcb252..cd5a2ef 100644 (file)
@@ -540,9 +540,9 @@ bool ParkingLot::parkConditionally(
     {
         std::unique_lock<std::mutex> locker(me->parkingLock);
         while (me->address && Clock::now() < timeout) {
-            // This is pretty funny. On Linux, if you wait until the max time, it immediately reports that you timed
-            // out. What's particularly bad about this is that it never releases the lock in that case. So, you loop
-            // forever without yielding to the thread that would wake you up.
+            // Falling back to wait() works around a bug in libstdc++ implementation of std::condition_variable. See:
+            // - https://bugs.webkit.org/show_bug.cgi?id=148027
+            // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58931
             if (timeout == Clock::time_point::max())
                 me->parkingCondition.wait(locker);
             else