Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" Newsgroups: comp.lang.c Subject: Re: notifying from inside or outside Date: Mon, 12 May 2025 14:34:01 -0700 Organization: A noiseless patient Spider Lines: 38 Message-ID: References: <20250512133259.596@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 12 May 2025 23:34:01 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0caa575f0af9d8032c1075ad2fad85b3"; logging-data="1386910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DKG6TQtn4GSFm4I38Gw4BnoLetKNFrFM=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:8VpExe2CxihzF/4gNjdB3+tO3wA= In-Reply-To: <20250512133259.596@kylheku.com> Content-Language: en-US Bytes: 2341 On 5/12/2025 1:52 PM, Kaz Kylheku wrote: > On 2025-05-09, Bonita Montero 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: [...] __________