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>
This commit is contained in:
Simon McVittie 2012-02-20 12:56:01 +00:00
parent 8d2b313158
commit bed34738fc
4 changed files with 0 additions and 40 deletions

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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

View file

@ -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)
{