Sujet : Re: notifying from inside or outside
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.lang.cDate : 12. May 2025, 22:34:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vvtpg9$1aacu$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 5/12/2025 1:52 PM, Kaz Kylheku wrote:
On 2025-05-09, Bonita Montero <Bonita.Montero@gmail.com> wrote:
So for Windows it's the best to notify individually while holding the
mutex.
All tests are with 31 threads waiting for a notification and one thread
which is notifying.
When you hit a condition variable while holding the mutex, you're
including, in the mutex's critical region, all those instructions needed
to perform that operation, possibly requiring a trip to the kernel.
There have to be conditions (no pun intended) under which that causes
a problem; you're just not hitting them in your test case.
Signalling from outside vs inside is a pretty old debate. I say signal from outside. Wait morphing aside for a moment...
He made a "correction" over in comp.lang.c++:
_______________
The Windows-times were summed-up times where each iteration included
the former iterations. Now it's corrected:
10000 rounds
inside:
one:
2.04687 seconds
all:
4 seconds
outside:
one:
1.03125 seconds
all:
1.14062 seconds
Am 09.05.2025 um 15:06 schrieb Bonita Montero:
[...]
__________