This bug has just been fixed upstream (cvs).

The change ensures that, regardless of what other threads do,
condition locker==self implies that the current thread owns the lock.
In the past, we used to rely on another thread writing into this
variable. Problems then arise when variables count and locker are
not synchronized together, for instance when they belong to
different cache lines.  Hairy!

- L.


===========================================================
--- GThreads.cpp        30 Aug 2010 03:14:07 -0000      1.21
+++ GThreads.cpp        30 Aug 2010 05:10:15 -0000      1.22
@@ -808,6 +808,7 @@
 void
 GMonitor::leave()
 {
+  static pthread_t pthread_null;
   pthread_t self = pthread_self();
   if (ok && (count>0 || !pthread_equal(locker, self)))
     G_THROW( ERR_MSG("GThreads.not_acq_broad") );
@@ -815,6 +816,7 @@
   if (count > 0)
     {
       count = 1;
+      locker = pthread_null;
       if (ok)
         pthread_mutex_unlock(&mutex);
     }








-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to