diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-20 12:56:01 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-21 14:41:44 +0000 |
commit | bed34738fcfe8d53bd017d79a633e0d94560c17c (patch) | |
tree | 6fb0a2a2460e35b0a18fdb0d62a3f1ac2ffed715 | |
parent | 8d2b313158b3c5f12a56608cc80d0c3138de0a09 (diff) | |
download | dbus-bed34738fcfe8d53bd017d79a633e0d94560c17c.tar.gz |
Remove _dbus_condvar_wake_all and both of its implementations
Neither was used, and the Windows version could lead to live-locks.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44609
Reviewed-by: Thiago Macieira <thiago@kde.org>
-rw-r--r-- | dbus/dbus-sysdeps-pthread.c | 6 | ||||
-rw-r--r-- | dbus/dbus-sysdeps-thread-win.c | 20 | ||||
-rw-r--r-- | dbus/dbus-threads-internal.h | 2 | ||||
-rw-r--r-- | dbus/dbus-threads.c | 12 |
4 files changed, 0 insertions, 40 deletions
diff --git a/dbus/dbus-sysdeps-pthread.c b/dbus/dbus-sysdeps-pthread.c index 9758934f..c9ec9e5b 100644 --- a/dbus/dbus-sysdeps-pthread.c +++ b/dbus/dbus-sysdeps-pthread.c @@ -262,12 +262,6 @@ _dbus_platform_condvar_wake_one (DBusCondVar *cond) PTHREAD_CHECK ("pthread_cond_signal", pthread_cond_signal (&cond->cond)); } -void -_dbus_platform_condvar_wake_all (DBusCondVar *cond) -{ - PTHREAD_CHECK ("pthread_cond_broadcast", pthread_cond_broadcast (&cond->cond)); -} - static void check_monotonic_clock (void) { diff --git a/dbus/dbus-sysdeps-thread-win.c b/dbus/dbus-sysdeps-thread-win.c index db486194..e30e7b87 100644 --- a/dbus/dbus-sysdeps-thread-win.c +++ b/dbus/dbus-sysdeps-thread-win.c @@ -256,26 +256,6 @@ _dbus_platform_condvar_wake_one (DBusCondVar *cond) LeaveCriticalSection (&cond->lock); } -void -_dbus_platform_condvar_wake_all (DBusCondVar *cond) -{ - EnterCriticalSection (&cond->lock); - - while (cond->list != NULL) - SetEvent (_dbus_list_pop_first (&cond->list)); - - if (cond->list != NULL) - { - /* Avoid live lock by pushing the waiter to the mutex lock - instruction, which is fair. If we don't do this, we could - acquire the condition variable again before the waiter has a - chance itself, leading to starvation. */ - Sleep (0); - } - - LeaveCriticalSection (&cond->lock); -} - dbus_bool_t _dbus_threads_init_platform_specific (void) { diff --git a/dbus/dbus-threads-internal.h b/dbus/dbus-threads-internal.h index 680a603f..64e8bac0 100644 --- a/dbus/dbus-threads-internal.h +++ b/dbus/dbus-threads-internal.h @@ -66,7 +66,6 @@ dbus_bool_t _dbus_condvar_wait_timeout (DBusCondVar *cond, DBusCMutex *mutex, int timeout_milliseconds); void _dbus_condvar_wake_one (DBusCondVar *cond); -void _dbus_condvar_wake_all (DBusCondVar *cond); void _dbus_condvar_new_at_location (DBusCondVar **location_p); void _dbus_condvar_free_at_location (DBusCondVar **location_p); @@ -90,7 +89,6 @@ dbus_bool_t _dbus_platform_condvar_wait_timeout (DBusCondVar *cond, DBusCMutex *mutex, int timeout_milliseconds); void _dbus_platform_condvar_wake_one (DBusCondVar *cond); -void _dbus_platform_condvar_wake_all (DBusCondVar *cond); DBUS_END_DECLS diff --git a/dbus/dbus-threads.c b/dbus/dbus-threads.c index df007834..bb1169db 100644 --- a/dbus/dbus-threads.c +++ b/dbus/dbus-threads.c @@ -343,18 +343,6 @@ _dbus_condvar_wake_one (DBusCondVar *cond) _dbus_platform_condvar_wake_one (cond); } -/** - * If there are threads waiting on the condition variable, wake - * up all of them. - * Does nothing if passed a #NULL pointer. - */ -void -_dbus_condvar_wake_all (DBusCondVar *cond) -{ - if (cond && thread_init_generation == _dbus_current_generation) - _dbus_platform_condvar_wake_all (cond); -} - static void shutdown_global_locks (void *data) { |