Blame dbus-1.0.1-pthread-holder-fix.patch
|
|
3887781 |
--- dbus-1.0.1/dbus/dbus-sysdeps-pthread.c 28 Oct 2006 01:41:37 -0000 1.5
|
|
|
3887781 |
+++ dbus-1.0.1/dbus/dbus-sysdeps-pthread.c 19 Nov 2006 12:40:47 -0000
|
|
|
3887781 |
@@ -153,6 +153,7 @@ _dbus_pthread_mutex_lock (DBusMutex *mut
|
|
|
3887781 |
{
|
|
|
3887781 |
/* Wait for the lock */
|
|
|
3887781 |
PTHREAD_CHECK ("pthread_mutex_lock", pthread_mutex_lock (&pmutex->lock));
|
|
|
3887781 |
+ pmutex->holder = self;
|
|
|
3887781 |
_dbus_assert (pmutex->count == 0);
|
|
|
3887781 |
}
|
|
|
3887781 |
|
|
|
3887781 |
@@ -222,10 +223,11 @@ _dbus_pthread_condvar_wait (DBusCondVar
|
|
|
3887781 |
_dbus_assert (pthread_equal (pmutex->holder, pthread_self ()));
|
|
|
3887781 |
|
|
|
3887781 |
old_count = pmutex->count;
|
|
|
3887781 |
- pmutex->count = 0;
|
|
|
3887781 |
+ pmutex->count = 0; /* allow other threads to lock */
|
|
|
3887781 |
PTHREAD_CHECK ("pthread_cond_wait", pthread_cond_wait (&pcond->cond, &pmutex->lock));
|
|
|
3887781 |
_dbus_assert (pmutex->count == 0);
|
|
|
3887781 |
pmutex->count = old_count;
|
|
|
3887781 |
+ pmutex->holder = pthread_self(); /* other threads may have locked the mutex in the meantime */
|
|
|
3887781 |
}
|
|
|
3887781 |
|
|
|
3887781 |
static dbus_bool_t
|
|
|
3887781 |
@@ -264,6 +266,7 @@ _dbus_pthread_condvar_wait_timeout (DBus
|
|
|
3887781 |
|
|
|
3887781 |
_dbus_assert (pmutex->count == 0);
|
|
|
3887781 |
pmutex->count = old_count;
|
|
|
3887781 |
+ pmutex->holder = pthread_self(); /* other threads may have locked the mutex in the meantime */
|
|
|
3887781 |
|
|
|
3887781 |
/* return true if we did not time out */
|
|
|
3887781 |
return result != ETIMEDOUT;
|
|
|
3887781 |
|