Sujet : Re: signalling a condvar from inside vs. signalling a condvar von outside
De : Bonita.Montero (at) *nospam* gmail.com (Bonita Montero)
Groupes : comp.lang.c++Date : 20. Apr 2025, 06:45:58
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vu21li$35vcb$1@raubtier-asyl.eternal-september.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : Mozilla Thunderbird
Am 20.04.2025 um 07:43 schrieb Chris M. Thomasson:
On 4/19/2025 9:29 PM, Bonita Montero wrote:
That's what I do after pushing n items to the queue:
>
if( !m_nWaiting )
return;
if( n >= m_nWaiting )
m_cv.notify_all();
else
do
m_cv.notify_one();
while( --n );
>
>
What's more efficient, notifying all threads individually or
notifying all threads at once ?
again, only broadcast hen you have to! wow.
You're simply silly. If I have more items in the queue
than waiting threads a broadcast is more efficient.