Annotation of /trunk/dbus/patches/dbus-1.0.1-pthread-holder-fix.diff
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 1452 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 1452 byte(s)
-import
1 | niro | 144 | Index: dbus-sysdeps-pthread.c |
2 | =================================================================== | ||
3 | RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-pthread.c,v | ||
4 | retrieving revision 1.5 | ||
5 | diff -u -p -B -b -r1.5 dbus-sysdeps-pthread.c | ||
6 | --- dbus/dbus-sysdeps-pthread.c 28 Oct 2006 01:41:37 -0000 1.5 | ||
7 | +++ dbus/dbus-sysdeps-pthread.c 19 Nov 2006 12:40:47 -0000 | ||
8 | @@ -153,6 +153,7 @@ _dbus_pthread_mutex_lock (DBusMutex *mut | ||
9 | { | ||
10 | /* Wait for the lock */ | ||
11 | PTHREAD_CHECK ("pthread_mutex_lock", pthread_mutex_lock (&pmutex->lock)); | ||
12 | + pmutex->holder = self; | ||
13 | _dbus_assert (pmutex->count == 0); | ||
14 | } | ||
15 | |||
16 | @@ -222,10 +223,11 @@ _dbus_pthread_condvar_wait (DBusCondVar | ||
17 | _dbus_assert (pthread_equal (pmutex->holder, pthread_self ())); | ||
18 | |||
19 | old_count = pmutex->count; | ||
20 | - pmutex->count = 0; | ||
21 | + pmutex->count = 0; /* allow other threads to lock */ | ||
22 | PTHREAD_CHECK ("pthread_cond_wait", pthread_cond_wait (&pcond->cond, &pmutex->lock)); | ||
23 | _dbus_assert (pmutex->count == 0); | ||
24 | pmutex->count = old_count; | ||
25 | + pmutex->holder = pthread_self(); /* other threads may have locked the mutex in the meantime */ | ||
26 | } | ||
27 | |||
28 | static dbus_bool_t | ||
29 | @@ -264,6 +266,7 @@ _dbus_pthread_condvar_wait_timeout (DBus | ||
30 | |||
31 | _dbus_assert (pmutex->count == 0); | ||
32 | pmutex->count = old_count; | ||
33 | + pmutex->holder = pthread_self(); /* other threads may have locked the mutex in the meantime */ | ||
34 | |||
35 | /* return true if we did not time out */ | ||
36 | return result != ETIMEDOUT; |