[x265] [PATCH] threading: in posix timedWait(), clear timeout flag if event was triggered

Steve Borho steve at borho.org
Sat Mar 14 20:01:04 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1426359206 18000
#      Sat Mar 14 13:53:26 2015 -0500
# Node ID ef559fa5674b2f83009b6182b5b25f2750980466
# Parent  c452299ac5f88b541af6b1cd775cd12f5a191e8f
threading: in posix timedWait(), clear timeout flag if event was triggered

In short, do not return true if the condition was triggered. I believe this was
causing a deadlock on POSIX with slow encodes.

diff -r c452299ac5f8 -r ef559fa5674b source/common/threading.h
--- a/source/common/threading.h	Sat Mar 14 10:27:32 2015 -0500
+++ b/source/common/threading.h	Sat Mar 14 13:53:26 2015 -0500
@@ -295,7 +295,10 @@
             bTimedOut = pthread_cond_timedwait(&m_cond, &m_mutex, &ts) == ETIMEDOUT;
         }
         if (m_counter > 0)
+        {
             m_counter--;
+            bTimedOut = false;
+        }
         pthread_mutex_unlock(&m_mutex);
         return bTimedOut;
     }


More information about the x265-devel mailing list