+2006-11-19 Thiago Macieira <thiago@kde.org>
+
+ * dbus/dbus-sysdeps-pthread.c (_dbus_pthread_mutex_lock,
+ _dbus_pthread_condvar_wait,
+ _dbus_pthread_condvar_wait_timeout): set pmutex->holder to
+ pthread_self() after coming back from a conditional variable
+ wait as well as in one codepath where it was forgotten.
+ Approved by: Havoc Pennington.
+
2006-11-17 Havoc Pennington <hp@redhat.com>
* update-dbus-docs.sh: allow setting fd.org username via env
{
/* Wait for the lock */
PTHREAD_CHECK ("pthread_mutex_lock", pthread_mutex_lock (&pmutex->lock));
+ pmutex->holder = self;
_dbus_assert (pmutex->count == 0);
}
_dbus_assert (pthread_equal (pmutex->holder, pthread_self ()));
old_count = pmutex->count;
- pmutex->count = 0;
+ pmutex->count = 0; /* allow other threads to lock */
PTHREAD_CHECK ("pthread_cond_wait", pthread_cond_wait (&pcond->cond, &pmutex->lock));
_dbus_assert (pmutex->count == 0);
pmutex->count = old_count;
+ pmutex->holder = pthread_self(); /* other threads may have locked the mutex in the meantime */
}
static dbus_bool_t
_dbus_assert (pmutex->count == 0);
pmutex->count = old_count;
+ pmutex->holder = pthread_self(); /* other threads may have locked the mutex in the meantime */
/* return true if we did not time out */
return result != ETIMEDOUT;