Change DispatchQueue::dispatch to use notify_one. (#308)
This prevents the thundering herd problem and should increase the
scalability of the DispatchQueue significantly.
Additionally the code the DispatchQueue was taken from made this
improvement five years ago:
79ad8a539d
Signed-off-by: Drew Lewis <cannada@google.com>
This commit is contained in:
parent
36e516924f
commit
daeea4ab7e
|
|
@ -66,7 +66,7 @@ DispatchQueue::dispatch(const fp_t& op)
|
|||
// Manual unlocking is done before notifying, to avoid waking up
|
||||
// the waiting thread only to block again (see notify_one for details)
|
||||
lock.unlock();
|
||||
cv_.notify_all();
|
||||
cv_.notify_one();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -79,7 +79,7 @@ DispatchQueue::dispatch(fp_t&& op)
|
|||
// Manual unlocking is done before notifying, to avoid waking up
|
||||
// the waiting thread only to block again (see notify_one for details)
|
||||
lock.unlock();
|
||||
cv_.notify_all();
|
||||
cv_.notify_one();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in New Issue