Avoid superfluous notifyAll calls in Channel.

Slightly reduces the notification overhead in multiple-reader or multiple-writer scenarios.
This commit is contained in:
Sönke Ludwig 2019-03-10 16:00:12 +01:00
parent edec8df026
commit 02f5b4f91d

View file

@ -188,7 +188,7 @@ private final class ChannelImpl(T, size_t buffer_size) {
thisus.m_items.popFront(); thisus.m_items.popFront();
} }
if (was_full) thisus.m_condition.notifyAll(); if (was_full) thisus.m_condition.notify();
return true; return true;
} }
@ -212,7 +212,7 @@ private final class ChannelImpl(T, size_t buffer_size) {
thisus.m_items.popFront(); thisus.m_items.popFront();
} }
if (was_full) thisus.m_condition.notifyAll(); if (was_full) thisus.m_condition.notify();
return ret.move; return ret.move;
} }
@ -235,7 +235,7 @@ private final class ChannelImpl(T, size_t buffer_size) {
swap(thisus.m_items, dst); swap(thisus.m_items, dst);
} }
if (was_full) thisus.m_condition.notifyAll(); if (was_full) thisus.m_condition.notify();
return true; return true;
} }
@ -256,7 +256,7 @@ private final class ChannelImpl(T, size_t buffer_size) {
thisus.m_items.put(item.move); thisus.m_items.put(item.move);
} }
if (need_notify) thisus.m_condition.notifyAll(); if (need_notify) thisus.m_condition.notify();
} }
} }