diff options
author | Richard Braun <rbraun@sceen.net> | 2018-01-30 20:44:24 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-01-30 20:44:24 +0100 |
commit | 9967e907feda967f237c30430f47357bc91332f5 (patch) | |
tree | afad99fa69ba8cd0aa38c7bc695667520805d4c5 /kern/condition.h | |
parent | bc6e853d4b27055056eebfd871aaf0fc60405b0f (diff) |
Fix condition variable broadcasting
The broadcast implementation is based on an invalid assumption, namely
that the first mutex_unlock call following condition_wait would be invoked
on the same mutex. Fixing this while guarding against the thundering herd
effect requires augmenting mutexes with a pointer to the condition
variable they may be associated with. Since the size of mutexes is
currently more important than broadcast scalability, the implementation
is simplified into one which suffers from the thundering herd effect.
Diffstat (limited to 'kern/condition.h')
-rw-r--r-- | kern/condition.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/kern/condition.h b/kern/condition.h index 90a59f0d..2082bee5 100644 --- a/kern/condition.h +++ b/kern/condition.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Richard Braun. + * Copyright (c) 2013-2018 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,16 +65,4 @@ int condition_timedwait(struct condition *condition, void condition_signal(struct condition *condition); void condition_broadcast(struct condition *condition); -/* - * Wake up a pending thread. - * - * This function isn't part of the standard condition variable interface. - * It is used to chain wake-ups to avoid the thundering herd effect. - * When broadcasting a condition variable, a single thread is actually - * awaken. Other threads become "pending waiters", still asleep but - * eligible for wake-up when the mutex associated to the condition variable, - * relocked when returning from condition_wait(), is finally unlocked. - */ -void condition_wakeup(struct condition *condition); - #endif /* _KERN_CONDITION_H */ |