Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Kleeneness is next to Godelness.


devel / comp.lang.c++ / A Java- / .NET-like monitor

SubjectAuthor
* A Java- / .NET-like monitorBonita Montero
+* Re: A Java- / .NET-like monitorBonita Montero
|`* Re: A Java- / .NET-like monitorChris M. Thomasson
| +* Re: A Java- / .NET-like monitorChris M. Thomasson
| |+* Re: A Java- / .NET-like monitorBonita Montero
| ||`- Re: A Java- / .NET-like monitorChris M. Thomasson
| |`- Re: A Java- / .NET-like monitorChris M. Thomasson
| `* Re: A Java- / .NET-like monitorBonita Montero
|  `- Re: A Java- / .NET-like monitorChris M. Thomasson
+* Re: A Java- / .NET-like monitorKaz Kylheku
|`* Re: A Java- / .NET-like monitorBonita Montero
| `* Re: A Java- / .NET-like monitorKaz Kylheku
|  `* Re: A Java- / .NET-like monitorBonita Montero
|   +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   |`* Re: A Java- / .NET-like monitorKaz Kylheku
|   | `- Re: A Java- / .NET-like monitorChris M. Thomasson
|   +* Re: A Java- / .NET-like monitorKaz Kylheku
|   |`* Re: A Java- / .NET-like monitorBonita Montero
|   | +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |`* Re: A Java- / .NET-like monitorBonita Montero
|   | | `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |+- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   | `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |+- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   | `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |  +- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |   `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |`* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    | `- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    +* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |`* Re: A Java- / .NET-like monitorPavel
|   | |   |   |    | `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |  `* Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |   `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |    `* Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |     +- Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     +* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     |+* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     ||+- Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||+- Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |     ||`* Re: A Java- / .NET-like monitorMichael S
|   | |   |   |    |     || `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||   `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||    +- Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||    `* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||     `* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     ||      +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |`* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      | +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      | |`- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      | `* Re: A Java- / .NET-like monitorFred. Zwarts
|   | |   |   |    |     ||      |  `* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      |   `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    `- Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      +* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |`* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     ||      | `* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      |  +- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |  `* Re: A Java- / .NET-like monitorMichael S
|   | |   |   |    |     ||      |   +- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |   `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    +* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    |+* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    || `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||  +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |    ||  |`- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |    ||  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    ||   `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||    `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    ||     `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||      `- Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    |`- Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      |    `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |     `- Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      `- Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     |+- Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |     |`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     | `* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |   `* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     |    `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |     `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |      +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |      |`- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |      `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |       `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |        `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |         `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |          `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |           `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |            `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   `- Re: A Java- / .NET-like monitorBonita Montero
|   | |   `* Re: A Java- / .NET-like monitorPavel
|   | `* Re: A Java- / .NET-like monitorKaz Kylheku
|   `* Re: A Java- / .NET-like monitorChris M. Thomasson
+* Re: A Java- / .NET-like monitorBonita Montero
`* Re: A Java- / .NET-like monitorBonita Montero

Pages:1234567891011
Re: A Java- / .NET-like monitor

<ujgi4a$evq1$8@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2727&group=comp.lang.c%2B%2B#2727

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Mon, 20 Nov 2023 13:12:41 -0800
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <ujgi4a$evq1$8@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <ujb7r2$3f4nr$1@dont-email.me>
<Xha6N.99518$wvv7.65238@fx14.iad> <ujbcaa$3ftah$1@dont-email.me>
<mpd6N.101930$wvv7.24116@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 20 Nov 2023 21:12:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4322877222dc651c772ffc6c8629112a";
logging-data="491329"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ft52Ct4R4M5+rjF3B3mC5RSKrUfn8QL8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:e0V7rroIqPttL6uO4slz9KANUYw=
In-Reply-To: <mpd6N.101930$wvv7.24116@fx14.iad>
Content-Language: en-US
 by: Chris M. Thomasson - Mon, 20 Nov 2023 21:12 UTC

On 11/18/2023 5:20 PM, Pavel wrote:
> Chris M. Thomasson wrote:
>> On 11/18/2023 1:47 PM, Scott Lurndal wrote:
>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>>> On 11/18/2023 9:53 AM, Pavel wrote:
>>>>> Bonita Montero wrote:
>>>>>> Am 18.11.2023 um 03:16 schrieb Pavel:
>>>>>>
>>>>>>> There is no system call in UNIX to wait for many conditions to be
>>>>>>> met
>>>>>>> at once; but I do not see why it would be useful.
>>>>>>
>>>>>> poll() and wait() wait for at least one condition to be met.
>>>>> what does it have to do with what I wrote?
>>>>>
>>>>> Again, what a system call that waits for many conditions to be met at
>>>>> once can be useful for?
>>>>
>>>> select?
>>>
>>> I took Pavel to mean 'wait for all conditions to be true' rather than
>>> 'wait for one or more conditions to be true'.
>>>
>>
>> Ahhh. I missed that. Sorry everybody! ;^o
> NP, Scott is correct, this was about "wait for many conditions to be met
> at once" that Bonita missed on Linux for some reason I still cannot get
> or relate to.

It guess Bonita does not know that a predicate for a condition variable
can contain many conditions.

Re: A Java- / .NET-like monitor

<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2728&group=comp.lang.c%2B%2B#2728

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Tue, 21 Nov 2023 10:25:22 +0100
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 21 Nov 2023 09:25:16 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="f0f194ce9f9b11a27a7d906f3db4e873";
logging-data="827572"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vfTHwWEs5zyFtPeCJkV4JFiHUfkYsrVM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UtxNznZk7Tv7Mv7okiMTf/c9INU=
Content-Language: de-DE
In-Reply-To: <ujgeu8$evq1$1@dont-email.me>
 by: Bonita Montero - Tue, 21 Nov 2023 09:25 UTC

Am 20.11.2023 um 21:18 schrieb Chris M. Thomasson:

> Did you read that article on MSDN as well? Iirc, its around 20 years old.

Has WFMO ever changed ?

Re: A Java- / .NET-like monitor

<20231124011442.00004937@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2756&group=comp.lang.c%2B%2B#2756

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 01:14:42 +0200
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <20231124011442.00004937@yahoo.com>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad>
<Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="195ed909073fd7e02250016b973f1660";
logging-data="2117678"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NHJzjYVQf6bOMvwX99htD1aUDyE0/vwM="
Cancel-Lock: sha1:WLC40i7pHj5wBnHHkvsmyJUGTrs=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Thu, 23 Nov 2023 23:14 UTC

On Sat, 18 Nov 2023 20:29:51 -0000 (UTC)
Kaz Kylheku <864-117-4973@kylheku.com> wrote:

> On 2023-11-18, Scott Lurndal <scott@slp53.sl.home> wrote:
> > Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> writes:
> >>Bonita Montero wrote:
> >>> Am 18.11.2023 um 03:16 schrieb Pavel:
> >>>
> >>>> There is no system call in UNIX to wait for many conditions to
> >>>> be met at once; but I do not see why it would be useful.
> >>>
> >>> poll() and wait() wait for at least one condition to be met.
> >>what does it have to do with what I wrote?
> >>
> >>Again, what a system call that waits for many conditions to be met
> >>at once can be useful for?
> >
> > Rendezvous.
> >
> > e.g. pthread_barrier_wait.
>
> Also this:
>
> while (!this_condition() && !that_condition() &&
> !other_condition()) pthread_cond_wait(&cond, &mutex);
>
> One condition variable can be used to wait for any subset of the
> actual conditions over the shared variables protected by the mutex.
>
> When I switched to a Win32 development job in the mid 1990's, it
> amused me that Win32 had all these stupid things like
> WaitForMultipleObjects (with a weird 64 limit), instead of just
> providing condition variables.
>

1. WaitForMultipleObjects() can wait on any mix of objects
2. More importantly, it can wait on wake up events originated both
inside the process and outside.

> Today, Microsoft provides condition variables.
>

Which, I would guess, never used by 99.9% of programs that were not
ported to Windows from some other platform.

> Modules of a large program should use callbacks to notify that
> something is ready. That's the most flexible API. The caller can
> build proper asynchronous control flows around that, or bind the
> callback to some signaling object according to how they see fit.
>
> Say I have a module that works with three other modules that can
> spontaneously make some condition ready. If they all provide a
> callback, I can set a flag in the callback and broadcast or signal a
> condition variable. Then I can have threads wait for all three
> things to be ready, or any one of the three things.
>

Re: A Java- / .NET-like monitor

<ujpcnq$27892$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2759&group=comp.lang.c%2B%2B#2759

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 23 Nov 2023 21:35:53 -0800
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <ujpcnq$27892$1@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 05:35:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7664f6b07543b36eac45e26755f90876";
logging-data="2335010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18G8bnQyzk4JGP65zYzd7YDbBoPjKlbt5E="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Tz0AC1QrPAzfC6D7UBURZgf2Vjw=
Content-Language: en-US
In-Reply-To: <20231124011442.00004937@yahoo.com>
 by: Chris M. Thomasson - Fri, 24 Nov 2023 05:35 UTC

On 11/23/2023 3:14 PM, Michael S wrote:
> On Sat, 18 Nov 2023 20:29:51 -0000 (UTC)
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>
>> On 2023-11-18, Scott Lurndal <scott@slp53.sl.home> wrote:
>>> Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> writes:
>>>> Bonita Montero wrote:
>>>>> Am 18.11.2023 um 03:16 schrieb Pavel:
>>>>>
>>>>>> There is no system call in UNIX to wait for many conditions to
>>>>>> be met at once; but I do not see why it would be useful.
>>>>>
>>>>> poll() and wait() wait for at least one condition to be met.
>>>> what does it have to do with what I wrote?
>>>>
>>>> Again, what a system call that waits for many conditions to be met
>>>> at once can be useful for?
>>>
>>> Rendezvous.
>>>
>>> e.g. pthread_barrier_wait.
>>
>> Also this:
>>
>> while (!this_condition() && !that_condition() &&
>> !other_condition()) pthread_cond_wait(&cond, &mutex);
>>
>> One condition variable can be used to wait for any subset of the
>> actual conditions over the shared variables protected by the mutex.
>>
>> When I switched to a Win32 development job in the mid 1990's, it
>> amused me that Win32 had all these stupid things like
>> WaitForMultipleObjects (with a weird 64 limit), instead of just
>> providing condition variables.
>>
>
> 1. WaitForMultipleObjects() can wait on any mix of objects
> 2. More importantly, it can wait on wake up events originated both
> inside the process and outside.
>
>
>> Today, Microsoft provides condition variables.
>>
>
> Which, I would guess, never used by 99.9% of programs that were not
> ported to Windows from some other platform.

Fwiw, check this out:

https://sourceware.org/pthreads-win32/

;^)

>
>> Modules of a large program should use callbacks to notify that
>> something is ready. That's the most flexible API. The caller can
>> build proper asynchronous control flows around that, or bind the
>> callback to some signaling object according to how they see fit.
>>
>> Say I have a module that works with three other modules that can
>> spontaneously make some condition ready. If they all provide a
>> callback, I can set a flag in the callback and broadcast or signal a
>> condition variable. Then I can have threads wait for all three
>> things to be ready, or any one of the three things.
>>
>
>

Re: A Java- / .NET-like monitor

<ujpctk$27892$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2760&group=comp.lang.c%2B%2B#2760

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 23 Nov 2023 21:38:59 -0800
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ujpctk$27892$2@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 05:39:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7664f6b07543b36eac45e26755f90876";
logging-data="2335010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eYNCko4Cx8ERiqPoDKDUW8+FTccPZgb4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uRgRtZ6ZPsQK8t3zY+sVXPPrFhs=
In-Reply-To: <ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 24 Nov 2023 05:38 UTC

On 11/21/2023 1:25 AM, Bonita Montero wrote:
> Am 20.11.2023 um 21:18 schrieb Chris M. Thomasson:
>
>> Did you read that article on MSDN as well? Iirc, its around 20 years old.
>
> Has WFMO ever changed ?
>

No, I don't think so.. The interesting aspect was about trying to avoid
starvation the the wait array wrt the IOCP vs Event contest. So, we were
advised to randomize and/or shift the positions wrt the event side wrt WFMO.

Re: A Java- / .NET-like monitor

<ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2768&group=comp.lang.c%2B%2B#2768

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 08:56:13 +0100
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
<ujpctk$27892$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 07:56:05 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="9ade70e49ca68ba2beb5a7fae8a1ed12";
logging-data="2370330"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Pdny5l8PK3hV4z7ZXVr3XjauUFMGVGGU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vRLp7aTHR0KNJf0k3z8K1kvv3/Y=
In-Reply-To: <ujpctk$27892$2@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Fri, 24 Nov 2023 07:56 UTC

Am 24.11.2023 um 06:38 schrieb Chris M. Thomasson:

> No, I don't think so.. The interesting aspect was about trying to avoid
> starvation the the wait array wrt the IOCP vs Event contest. So, we were
> advised to randomize and/or shift the positions wrt the event side wrt
> WFMO.

You officially can't wait for an IOCP handle with WFMO, although this
actually works with my Windows 11 computer. MS should document that and
make a statement since which Windows version this actually works. This
isn't a strong requirement but it would be nice to wait for IOCPs with
WFMO in some cases.

Re: A Java- / .NET-like monitor

<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2770&group=comp.lang.c%2B%2B#2770

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 08:59:27 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 07:59:19 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="9ade70e49ca68ba2beb5a7fae8a1ed12";
logging-data="2370330"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1vhKPF7DJMEtJKMclgdEqrAYPvB72XxY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:zDlxcmQIAfdedvhRO/FHWvAJRDk=
In-Reply-To: <ujpcnq$27892$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Fri, 24 Nov 2023 07:59 UTC

Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:

> On 11/23/2023 3:14 PM, Michael S wrote:

>> Which, I would guess, never used by 99.9% of programs that were not
>> ported to Windows from some other platform.

> Fwiw, check this out:
> https://sourceware.org/pthreads-win32/

Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:

That's an unnecessary discussion for a C++ programmer since the RAII-ish
mutexes and condition variables since C++11 are more convenient to use.

Re: A Java- / .NET-like monitor

<ujppo2$28srl$5@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2779&group=comp.lang.c%2B%2B#2779

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 01:17:53 -0800
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ujppo2$28srl$5@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 09:17:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7664f6b07543b36eac45e26755f90876";
logging-data="2388853"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WtynKPsrZJaO3wflU9ow1CfRzljDv/6w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:xObqPLjTODgl0tKRX+4sfFuboA0=
Content-Language: en-US
In-Reply-To: <ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Fri, 24 Nov 2023 09:17 UTC

On 11/23/2023 11:59 PM, Bonita Montero wrote:
> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>
>> On 11/23/2023 3:14 PM, Michael S wrote:
>
>>> Which, I would guess, never used by 99.9% of programs that were not
>>> ported to Windows from some other platform.
>
>> Fwiw, check this out:
>> https://sourceware.org/pthreads-win32/
>
> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>
> That's an unnecessary discussion for a C++ programmer since the RAII-ish
> mutexes and condition variables since C++11 are more convenient to use.
>
>
>
>

Have you ever wrapped up a C API in C++ using RAII before?

Re: A Java- / .NET-like monitor

<ujpq0f$28srl$6@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2780&group=comp.lang.c%2B%2B#2780

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 01:22:22 -0800
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ujpq0f$28srl$6@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
<ujpctk$27892$2@dont-email.me>
<ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 09:22:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7664f6b07543b36eac45e26755f90876";
logging-data="2388853"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19R/lBNqgHSCqtqkWczjdv3fHxoOkDrf/4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Ek5i0/WMCLRm59ZbMs67sECba1I=
In-Reply-To: <ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 24 Nov 2023 09:22 UTC

On 11/23/2023 11:56 PM, Bonita Montero wrote:
> Am 24.11.2023 um 06:38 schrieb Chris M. Thomasson:
>
>> No, I don't think so.. The interesting aspect was about trying to
>> avoid starvation the the wait array wrt the IOCP vs Event contest. So,
>> we were advised to randomize and/or shift the positions wrt the event
>> side wrt WFMO.
>
> You officially can't wait for an IOCP handle with WFMO, although this
> actually works with my Windows 11 computer. MS should document that and
> make a statement since which Windows version this actually works. This
> isn't a strong requirement but it would be nice to wait for IOCPs with
> WFMO in some cases.
>

Humm... You should be using:

https://learn.microsoft.com/en-us/windows/win32/fileio/getqueuedcompletionstatusex-func

Re: A Java- / .NET-like monitor

<ujpq5l$291sr$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2782&group=comp.lang.c%2B%2B#2782

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 10:25:17 +0100
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <ujpq5l$291sr$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 09:25:09 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="9ade70e49ca68ba2beb5a7fae8a1ed12";
logging-data="2394011"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fRbbe6VU323PZdBAGirjcwGHZwwql5AQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lO+yS2ycc7LJgP30KoNcQ+HcvcE=
Content-Language: de-DE
In-Reply-To: <ujppo2$28srl$5@dont-email.me>
 by: Bonita Montero - Fri, 24 Nov 2023 09:25 UTC

Am 24.11.2023 um 10:17 schrieb Chris M. Thomasson:

> Have you ever wrapped up a C API in C++ using RAII before?

Sometimes, but mostly I don't write a dedicated class for that but use
my own invoke_on_destruct class which is similar to the experimental#
scope_exit: https://en.cppreference.com/w/cpp/experimental/scope_exit

Re: A Java- / .NET-like monitor

<bL38N.65219$cAm7.33028@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2784&group=comp.lang.c%2B%2B#2784

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: A Java- / .NET-like monitor
Newsgroups: comp.lang.c++
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org> <pMV4N.7286$pgLd.6741@fx05.iad> <uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org> <88V5N.33567$Ee89.15971@fx17.iad> <uj99na$35s1q$1@raubtier-asyl.eternal-september.org> <CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad> <20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com> <ujpcnq$27892$1@dont-email.me> <ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org> <ujppo2$28srl$5@dont-email.me>
Lines: 28
Message-ID: <bL38N.65219$cAm7.33028@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 24 Nov 2023 15:59:03 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 24 Nov 2023 15:59:03 GMT
X-Received-Bytes: 2007
 by: Scott Lurndal - Fri, 24 Nov 2023 15:59 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>On 11/23/2023 11:59 PM, Bonita Montero wrote:
>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>
>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>
>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>> ported to Windows from some other platform.
>>
>>> Fwiw, check this out:
>>> https://sourceware.org/pthreads-win32/
>>
>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>
>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>> mutexes and condition variables since C++11 are more convenient to use.
>>
>>
>>
>>
>
>Have you ever wrapped up a C API in C++ using RAII before?

I generally consider using RAII for synchronization primitives
to be counterindicated. Amongst the reasons:
1) The critical sections usually end up being far to large
2) It makes reasoning about the synchronization code and
potential nested locking more difficult.

Re: A Java- / .NET-like monitor

<ujqotn$2dtfl$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2785&group=comp.lang.c%2B%2B#2785

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 19:10:09 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <ujqotn$2dtfl$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
<ujpctk$27892$2@dont-email.me>
<ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>
<ujpq0f$28srl$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 18:09:59 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="9ade70e49ca68ba2beb5a7fae8a1ed12";
logging-data="2553333"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YHVMqIfbQv2DfFwK5FfowFD4GLoXy2UI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:w7xKOcIMZqpi9GHlZtCrhf+e87Y=
In-Reply-To: <ujpq0f$28srl$6@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Fri, 24 Nov 2023 18:10 UTC

Am 24.11.2023 um 10:22 schrieb Chris M. Thomasson:
> On 11/23/2023 11:56 PM, Bonita Montero wrote:
>> Am 24.11.2023 um 06:38 schrieb Chris M. Thomasson:
>>
>>> No, I don't think so.. The interesting aspect was about trying to
>>> avoid starvation the the wait array wrt the IOCP vs Event contest.
>>> So, we were advised to randomize and/or shift the positions wrt the
>>> event side wrt WFMO.
>>
>> You officially can't wait for an IOCP handle with WFMO, although this
>> actually works with my Windows 11 computer. MS should document that and
>> make a statement since which Windows version this actually works. This
>> isn't a strong requirement but it would be nice to wait for IOCPs with
>> WFMO in some cases.
>>
>
> Humm... You should be using:
>
> https://learn.microsoft.com/en-us/windows/win32/fileio/getqueuedcompletionstatusex-func

Why do you think I don't know GetQueuedCompletionStatus() ?
I said that it would be nice to do a WFMO on a IOCP in addition to that.

Re: A Java- / .NET-like monitor

<20231124102842.71@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2787&group=comp.lang.c%2B%2B#2787

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 18:33:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <20231124102842.71@kylheku.com>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
Injection-Date: Fri, 24 Nov 2023 18:33:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c1ea8c6eccf6dad4e5ac74f80adfa4fc";
logging-data="2559265"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sT4YyGEjyvbiZlj9/00HdBg6S9RzdFyo="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:y5rD9C+JncNDf1M6X5EEd3+rJas=
 by: Kaz Kylheku - Fri, 24 Nov 2023 18:33 UTC

On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>
>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>
>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>> ported to Windows from some other platform.
>>>
>>>> Fwiw, check this out:
>>>> https://sourceware.org/pthreads-win32/
>>>
>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>
>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>> mutexes and condition variables since C++11 are more convenient to use.
>>>
>>>
>>>
>>>
>>
>>Have you ever wrapped up a C API in C++ using RAII before?
>
> I generally consider using RAII for synchronization primitives
> to be counterindicated. Amongst the reasons:
> 1) The critical sections usually end up being far to large

Use braces?

{
mutex_locker m(obj);

}

> 2) It makes reasoning about the synchronization code and
> potential nested locking more difficult.

It's just a syntactic sugar to avoid forgetting to unlock.

The thing is, you need a complementary unlocker to
avoid the nesting:

{
mutex_locker m(obj);

// ...

if (obj.situation()) {
mutex_unlocker u(obj); // temporarily give up mutex
other_obj.method(); // this can call us back again
}
}

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: A Java- / .NET-like monitor

<ujrc8c$2gjhg$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2790&group=comp.lang.c%2B%2B#2790

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 15:39:54 -0800
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <ujrc8c$2gjhg$3@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 23:39:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a478786200890072e344b77cbd100045";
logging-data="2641456"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189AaJhIonRfhTtbSOGjunmdxAftGRuqIg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:u7WGxLHLVELyY655QRkboYINoTU=
Content-Language: en-US
In-Reply-To: <20231124102842.71@kylheku.com>
 by: Chris M. Thomasson - Fri, 24 Nov 2023 23:39 UTC

On 11/24/2023 10:33 AM, Kaz Kylheku wrote:
> On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>
>>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>>
>>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>>> ported to Windows from some other platform.
>>>>
>>>>> Fwiw, check this out:
>>>>> https://sourceware.org/pthreads-win32/
>>>>
>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>
>>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>>> mutexes and condition variables since C++11 are more convenient to use.
>>>>
>>>>
>>>>
>>>>
>>>
>>> Have you ever wrapped up a C API in C++ using RAII before?
>>
>> I generally consider using RAII for synchronization primitives
>> to be counterindicated. Amongst the reasons:
>> 1) The critical sections usually end up being far to large
>
> Use braces?
>
> {
> mutex_locker m(obj);
>
>
> }

DING!!! :^)

>
>> 2) It makes reasoning about the synchronization code and
>> potential nested locking more difficult.
>
> It's just a syntactic sugar to avoid forgetting to unlock.
>
> The thing is, you need a complementary unlocker to
> avoid the nesting:
>
> {
> mutex_locker m(obj);
>
> // ...
>
> if (obj.situation()) {
> mutex_unlocker u(obj); // temporarily give up mutex
> other_obj.method(); // this can call us back again
> }
> }
>
>

:^)

Re: A Java- / .NET-like monitor

<ujrce8$2gjhg$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2791&group=comp.lang.c%2B%2B#2791

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 15:43:03 -0800
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <ujrce8$2gjhg$4@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
<ujpctk$27892$2@dont-email.me>
<ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>
<ujpq0f$28srl$6@dont-email.me>
<ujqotn$2dtfl$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Nov 2023 23:43:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a478786200890072e344b77cbd100045";
logging-data="2641456"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XJURnx6PWvBy060uCAQXSq7wRAfyirdE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:xhptRzWnv/dXncVVINIT6yrL19A=
Content-Language: en-US
In-Reply-To: <ujqotn$2dtfl$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Fri, 24 Nov 2023 23:43 UTC

On 11/24/2023 10:10 AM, Bonita Montero wrote:
> Am 24.11.2023 um 10:22 schrieb Chris M. Thomasson:
>> On 11/23/2023 11:56 PM, Bonita Montero wrote:
>>> Am 24.11.2023 um 06:38 schrieb Chris M. Thomasson:
>>>
>>>> No, I don't think so.. The interesting aspect was about trying to
>>>> avoid starvation the the wait array wrt the IOCP vs Event contest.
>>>> So, we were advised to randomize and/or shift the positions wrt the
>>>> event side wrt WFMO.
>>>
>>> You officially can't wait for an IOCP handle with WFMO, although this
>>> actually works with my Windows 11 computer. MS should document that and
>>> make a statement since which Windows version this actually works. This
>>> isn't a strong requirement but it would be nice to wait for IOCPs with
>>> WFMO in some cases.
>>>
>>
>> Humm... You should be using:
>>
>> https://learn.microsoft.com/en-us/windows/win32/fileio/getqueuedcompletionstatusex-func
>
> Why do you think I don't know GetQueuedCompletionStatus() ?

Btw, I said:

GetQueuedCompletionStatusEx

NOT

GetQueuedCompletionStatus

:^)

> I said that it would be nice to do a WFMO on a IOCP in addition to that.

How would that even work? You do not need to create an event per
connection in IOCP model. IOCP is a different model that is not
compatible with WFMO.

Re: A Java- / .NET-like monitor

<3Wa8N.2235$PJoc.2084@fx04.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2792&group=comp.lang.c%2B%2B#2792

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!nntp.comgw.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx04.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: A Java- / .NET-like monitor
Newsgroups: comp.lang.c++
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org> <88V5N.33567$Ee89.15971@fx17.iad> <uj99na$35s1q$1@raubtier-asyl.eternal-september.org> <CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad> <20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com> <ujpcnq$27892$1@dont-email.me> <ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org> <ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad> <20231124102842.71@kylheku.com> <ujrc8c$2gjhg$3@dont-email.me>
Lines: 52
Message-ID: <3Wa8N.2235$PJoc.2084@fx04.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 25 Nov 2023 00:08:31 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 25 Nov 2023 00:08:31 GMT
X-Received-Bytes: 2514
 by: Scott Lurndal - Sat, 25 Nov 2023 00:08 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>On 11/24/2023 10:33 AM, Kaz Kylheku wrote:
>> On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>>> On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>
>>>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>>>
>>>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>>>> ported to Windows from some other platform.
>>>>>
>>>>>> Fwiw, check this out:
>>>>>> https://sourceware.org/pthreads-win32/
>>>>>
>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>
>>>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>>>> mutexes and condition variables since C++11 are more convenient to use.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> Have you ever wrapped up a C API in C++ using RAII before?
>>>
>>> I generally consider using RAII for synchronization primitives
>>> to be counterindicated. Amongst the reasons:
>>> 1) The critical sections usually end up being far to large
>>
>> Use braces?
>>
>> {
>> mutex_locker m(obj);
>>
>>
>> }
>
>DING!!! :^)

No, not really. It's not always that
easy, and sometimes programmers even use 'goto'.

That's certainly no more readable than

pthread_lock(obj);

do something

pthread_unlock(obj);

I'd argue the RAII solution is less readable.

Re: A Java- / .NET-like monitor

<ujrf2b$2gqoe$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2793&group=comp.lang.c%2B%2B#2793

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 24 Nov 2023 16:27:54 -0800
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <ujrf2b$2gqoe$2@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com> <ujrc8c$2gjhg$3@dont-email.me>
<3Wa8N.2235$PJoc.2084@fx04.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Nov 2023 00:27:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a478786200890072e344b77cbd100045";
logging-data="2648846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ffKTlFvAnKGD+AjC+Vyngl4dFi/KHneU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:o04trvRCuFLZ0P1rvvI8xqc/6jU=
Content-Language: en-US
In-Reply-To: <3Wa8N.2235$PJoc.2084@fx04.iad>
 by: Chris M. Thomasson - Sat, 25 Nov 2023 00:27 UTC

On 11/24/2023 4:08 PM, Scott Lurndal wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 11/24/2023 10:33 AM, Kaz Kylheku wrote:
>>> On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
>>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>>>> On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>>
>>>>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>>>>
>>>>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>>>>> ported to Windows from some other platform.
>>>>>>
>>>>>>> Fwiw, check this out:
>>>>>>> https://sourceware.org/pthreads-win32/
>>>>>>
>>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>>
>>>>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>>>>> mutexes and condition variables since C++11 are more convenient to use.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> Have you ever wrapped up a C API in C++ using RAII before?
>>>>
>>>> I generally consider using RAII for synchronization primitives
>>>> to be counterindicated. Amongst the reasons:
>>>> 1) The critical sections usually end up being far to large
>>>
>>> Use braces?
>>>
>>> {
>>> mutex_locker m(obj);
>>>
>>>
>>> }
>>
>> DING!!! :^)
>
> No, not really. It's not always that
> easy, and sometimes programmers even use 'goto'.
>
> That's certainly no more readable than
>
> pthread_lock(obj);
>
> do something
>
> pthread_unlock(obj);
>
> I'd argue the RAII solution is less readable.

RAII can come in handy. I don't think its all that bad. Humm...
_______________________
{ mutex_raii_lock(my_lock);
} _______________________

vs:
_______________________
my_lock.lock();
my_lock.unlock();
_______________________

Btw, wrt C++, RAII tends to work rather well with exceptions... ;^)

Re: A Java- / .NET-like monitor

<ujsnp1$2poh8$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2794&group=comp.lang.c%2B%2B#2794

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: F.Zwa...@HetNet.nl (Fred. Zwarts)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 25 Nov 2023 13:02:42 +0100
Organization: A noiseless patient Spider
Lines: 91
Message-ID: <ujsnp1$2poh8$3@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com> <ujrc8c$2gjhg$3@dont-email.me>
<3Wa8N.2235$PJoc.2084@fx04.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Nov 2023 12:02:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5ead2c6ff4b2bc93db782fd2f0d35705";
logging-data="2941480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eJZfrMLmb+ehwZu2N2PuQ"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XRylM0ex/8L6Ruwooq5Q7jVtyg4=
In-Reply-To: <3Wa8N.2235$PJoc.2084@fx04.iad>
Content-Language: en-GB
 by: Fred. Zwarts - Sat, 25 Nov 2023 12:02 UTC

Op 25.nov.2023 om 01:08 schreef Scott Lurndal:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 11/24/2023 10:33 AM, Kaz Kylheku wrote:
>>> On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
>>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>>>> On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>>
>>>>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>>>>
>>>>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>>>>> ported to Windows from some other platform.
>>>>>>
>>>>>>> Fwiw, check this out:
>>>>>>> https://sourceware.org/pthreads-win32/
>>>>>>
>>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>>
>>>>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>>>>> mutexes and condition variables since C++11 are more convenient to use.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> Have you ever wrapped up a C API in C++ using RAII before?
>>>>
>>>> I generally consider using RAII for synchronization primitives
>>>> to be counterindicated. Amongst the reasons:
>>>> 1) The critical sections usually end up being far to large
>>>
>>> Use braces?
>>>
>>> {
>>> mutex_locker m(obj);
>>>
>>>
>>> }
>>
>> DING!!! :^)
>
> No, not really. It's not always that
> easy, and sometimes programmers even use 'goto'.
>
> That's certainly no more readable than
>
> pthread_lock(obj);
>
> do something
>
> pthread_unlock(obj);
>
> I'd argue the RAII solution is less readable.

In many cases it is not that simple.
It is more like:

{
mutex_locker m(obj);
do something
if (....) continue;
if (....) break;
if (...) return;
do something else
}

vs.:

pthread_lock(obj);
{
do something
if (...) {
pthread_unlock(obj);
continue;
}
if (...) {
pthread_unlock(obj);
break;
}
if (....) {
pthread_unlock(obj);
return;
}
do something else
} catch (...) {
pthread_unlock(obj);
throw;
}
pthread_unlock(obj);

Personally I find the first way more readable and easier to maintain.

Re: A Java- / .NET-like monitor

<ujsnr8$2prnc$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2795&group=comp.lang.c%2B%2B#2795

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 25 Nov 2023 13:04:01 +0100
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <ujsnr8$2prnc$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uihs34$22jil$2@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<ujc4la$3mjh0$1@raubtier-asyl.eternal-september.org>
<20231118205852.379@kylheku.com>
<ujc8ad$3n2sv$1@raubtier-asyl.eternal-september.org>
<20231118220242.793@kylheku.com>
<ujcq5b$3pgf8$2@raubtier-asyl.eternal-september.org>
<ujdq0m$3u8mv$7@dont-email.me>
<ujfj9t$admf$1@raubtier-asyl.eternal-september.org>
<ujgeu8$evq1$1@dont-email.me>
<ujht1s$p85k$1@raubtier-asyl.eternal-september.org>
<ujpctk$27892$2@dont-email.me>
<ujpkul$28aoq$2@raubtier-asyl.eternal-september.org>
<ujpq0f$28srl$6@dont-email.me>
<ujqotn$2dtfl$1@raubtier-asyl.eternal-september.org>
<ujrce8$2gjhg$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 25 Nov 2023 12:03:52 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="c7d7c344a75e43bef168361525523d8d";
logging-data="2944748"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18v2wb9JevKxa+vjK7iGAzuznsuFfK6FVg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:EvtzlJKMx0NyDPQNMvYrLeCHrbw=
In-Reply-To: <ujrce8$2gjhg$4@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Sat, 25 Nov 2023 12:04 UTC

Am 25.11.2023 um 00:43 schrieb Chris M. Thomasson:

> How would that even work? You do not need to create an event per
> connection in IOCP model. IOCP is a different model that is not
> compatible with WFMO.

You'd have to ask GQCS after you waited. Actually WFMO works
on a IOCP für my Windows 11 PC, but this isn't documented.

Re: A Java- / .NET-like monitor

<ujsobk$2ps2p$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2797&group=comp.lang.c%2B%2B#2797

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 25 Nov 2023 13:12:46 +0100
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <ujsobk$2ps2p$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Nov 2023 12:12:36 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="c7d7c344a75e43bef168361525523d8d";
logging-data="2945113"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qsUJk4CXA40TSNsmGfjZiR/x36jaPyf0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:rlIIHXRsZYL8YMn/elMwwk5T1hw=
Content-Language: de-DE
In-Reply-To: <20231124102842.71@kylheku.com>
 by: Bonita Montero - Sat, 25 Nov 2023 12:12 UTC

Am 24.11.2023 um 19:33 schrieb Kaz Kylheku:

> It's just a syntactic sugar to avoid forgetting to unlock ...

RAII is magnitudes more convenient and lass error-prone
than manual resource handling.

Re: A Java- / .NET-like monitor

<ujsr1n$2q7r7$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2798&group=comp.lang.c%2B%2B#2798

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 25 Nov 2023 13:58:31 +0100
Organization: A noiseless patient Spider
Lines: 77
Message-ID: <ujsr1n$2q7r7$1@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Nov 2023 12:58:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="17bcbfbdcd501e3c2a545c50e5bdddb7";
logging-data="2957159"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yPVSCr1CEzNp/j5B03UekM/n0a+GxEew="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:RJT7cNV3L4/nhbZGl6jIbxVa7ps=
Content-Language: en-GB
In-Reply-To: <20231124102842.71@kylheku.com>
 by: David Brown - Sat, 25 Nov 2023 12:58 UTC

On 24/11/2023 19:33, Kaz Kylheku wrote:
> On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>
>>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>>
>>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>>> ported to Windows from some other platform.
>>>>
>>>>> Fwiw, check this out:
>>>>> https://sourceware.org/pthreads-win32/
>>>>
>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>
>>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>>> mutexes and condition variables since C++11 are more convenient to use.
>>>>
>>>>
>>>>
>>>>
>>>
>>> Have you ever wrapped up a C API in C++ using RAII before?
>>
>> I generally consider using RAII for synchronization primitives
>> to be counterindicated. Amongst the reasons:
>> 1) The critical sections usually end up being far to large
>
> Use braces?

Yes.

>
> {
> mutex_locker m(obj);
>
>
> }
>
>> 2) It makes reasoning about the synchronization code and
>> potential nested locking more difficult.
>
> It's just a syntactic sugar to avoid forgetting to unlock.

That makes it sound like it is possible to use RAII locks to avoid
thinking too much, and that's a bad attitude. I would rather say that
RAII lockers can be useful to keep code clearer, and make the locked
section obvious with less clutter. It is still just as important to
think carefully about where the locks go!

>
> The thing is, you need a complementary unlocker to
> avoid the nesting:
>
> {
> mutex_locker m(obj);
>
> // ...
>
> if (obj.situation()) {
> mutex_unlocker u(obj); // temporarily give up mutex
> other_obj.method(); // this can call us back again
> }
> }
>
>

With unlockers, you are getting complicated again, and it's hard to
understand and reason about the locks. They can be useful, but rarely.

IME, RAII locks are sometimes a better choice, while other times free
lock and unlock functions are better. There is no "one size fits all"
answer.

Re: A Java- / .NET-like monitor

<S8q8N.22591$yAie.14909@fx44.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2799&group=comp.lang.c%2B%2B#2799

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx44.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: A Java- / .NET-like monitor
Newsgroups: comp.lang.c++
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org> <CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad> <20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com> <ujpcnq$27892$1@dont-email.me> <ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org> <ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad> <20231124102842.71@kylheku.com> <ujrc8c$2gjhg$3@dont-email.me> <3Wa8N.2235$PJoc.2084@fx04.iad> <ujsnp1$2poh8$3@dont-email.me>
Lines: 114
Message-ID: <S8q8N.22591$yAie.14909@fx44.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 25 Nov 2023 17:28:18 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 25 Nov 2023 17:28:18 GMT
X-Received-Bytes: 3967
 by: Scott Lurndal - Sat, 25 Nov 2023 17:28 UTC

"Fred. Zwarts" <F.Zwarts@HetNet.nl> writes:
>Op 25.nov.2023 om 01:08 schreef Scott Lurndal:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 11/24/2023 10:33 AM, Kaz Kylheku wrote:
>>>> On 2023-11-24, Scott Lurndal <scott@slp53.sl.home> wrote:
>>>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>>>>> On 11/23/2023 11:59 PM, Bonita Montero wrote:
>>>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>>>
>>>>>>>> On 11/23/2023 3:14 PM, Michael S wrote:
>>>>>>>
>>>>>>>>> Which, I would guess, never used by 99.9% of programs that were not
>>>>>>>>> ported to Windows from some other platform.
>>>>>>>
>>>>>>>> Fwiw, check this out:
>>>>>>>> https://sourceware.org/pthreads-win32/
>>>>>>>
>>>>>>> Am 24.11.2023 um 06:35 schrieb Chris M. Thomasson:
>>>>>>>
>>>>>>> That's an unnecessary discussion for a C++ programmer since the RAII-ish
>>>>>>> mutexes and condition variables since C++11 are more convenient to use.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> Have you ever wrapped up a C API in C++ using RAII before?
>>>>>
>>>>> I generally consider using RAII for synchronization primitives
>>>>> to be counterindicated. Amongst the reasons:
>>>>> 1) The critical sections usually end up being far to large
>>>>
>>>> Use braces?
>>>>
>>>> {
>>>> mutex_locker m(obj);
>>>>
>>>>
>>>> }
>>>
>>> DING!!! :^)
>>
>> No, not really. It's not always that
>> easy, and sometimes programmers even use 'goto'.
>>
>> That's certainly no more readable than
>>
>> pthread_lock(obj);
>>
>> do something
>>
>> pthread_unlock(obj);
>>
>> I'd argue the RAII solution is less readable.
>
>In many cases it is not that simple.
>It is more like:
>
> {
> mutex_locker m(obj);
> do something
> if (....) continue;
> if (....) break;
> if (...) return;
> do something else
> }
>
>vs.:
>
> pthread_lock(obj);
> {
> do something
> if (...) {
> pthread_unlock(obj);
> continue;
> }
> if (...) {
> pthread_unlock(obj);
> break;
> }
> if (....) {
> pthread_unlock(obj);
> return;
> }
> do something else
> } catch (...) {
> pthread_unlock(obj);
> throw;
> }
> pthread_unlock(obj);
>
>Personally I find the first way more readable and easier to maintain.

I'd argue that the critical region may be too large if all those
checks are required within.

I've used both, but in code (bare metal os/hv) compiled with
-fno-exceptions the following is preferable to RAII.

pthread_lock(obj);

if (xxx) goto unlock;

do something

if (yyy) goto unlock;

do something else

unlock:
pthread_unlock(obj);

six of one, half dozen of the other. This solution doesn't have
magic behavior and can more easily be reasoned to be correct.

Re: A Java- / .NET-like monitor

<ujtc1t$2sp67$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2800&group=comp.lang.c%2B%2B#2800

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 25 Nov 2023 18:48:55 +0100
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ujtc1t$2sp67$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com> <ujrc8c$2gjhg$3@dont-email.me>
<3Wa8N.2235$PJoc.2084@fx04.iad> <ujsnp1$2poh8$3@dont-email.me>
<S8q8N.22591$yAie.14909@fx44.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Nov 2023 17:48:46 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="c7d7c344a75e43bef168361525523d8d";
logging-data="3040455"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BAYztiKK17i+/vdx0niXdDpQYYvT/TX8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QRgiYP79/dy8/GJVOd7LVRDQsXA=
In-Reply-To: <S8q8N.22591$yAie.14909@fx44.iad>
Content-Language: de-DE
 by: Bonita Montero - Sat, 25 Nov 2023 17:48 UTC

Am 25.11.2023 um 18:28 schrieb Scott Lurndal:

> I've used both, but in code (bare metal os/hv) compiled with
> -fno-exceptions the following is preferable to RAII.
>
> pthread_lock(obj);
>
> if (xxx) goto unlock;
>
> do something
>
> if (yyy) goto unlock;
>
> do something else
>
> unlock:
> pthread_unlock(obj);

Why do you disable exceptions with code that doesn't throw ?

Re: A Java- / .NET-like monitor

<NLq8N.65597$cAm7.60868@fx18.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2801&group=comp.lang.c%2B%2B#2801

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: A Java- / .NET-like monitor
Newsgroups: comp.lang.c++
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org> <20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com> <ujpcnq$27892$1@dont-email.me> <ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org> <ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad> <20231124102842.71@kylheku.com> <ujrc8c$2gjhg$3@dont-email.me> <3Wa8N.2235$PJoc.2084@fx04.iad> <ujsnp1$2poh8$3@dont-email.me> <S8q8N.22591$yAie.14909@fx44.iad> <ujtc1t$2sp67$1@raubtier-asyl.eternal-september.org>
Lines: 24
Message-ID: <NLq8N.65597$cAm7.60868@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 25 Nov 2023 18:09:49 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 25 Nov 2023 18:09:49 GMT
X-Received-Bytes: 1642
 by: Scott Lurndal - Sat, 25 Nov 2023 18:09 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 25.11.2023 um 18:28 schrieb Scott Lurndal:
>
>> I've used both, but in code (bare metal os/hv) compiled with
>> -fno-exceptions the following is preferable to RAII.
>>
>> pthread_lock(obj);
>>
>> if (xxx) goto unlock;
>>
>> do something
>>
>> if (yyy) goto unlock;
>>
>> do something else
>>
>> unlock:
>> pthread_unlock(obj);
>
>Why do you disable exceptions with code that doesn't throw ?

To prevent the code from ever throwing, of course and to ensure
that no exception infrastructure gets generated into the object
files.

Re: A Java- / .NET-like monitor

<20231125100947.641@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2802&group=comp.lang.c%2B%2B#2802

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 25 Nov 2023 18:10:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <20231125100947.641@kylheku.com>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<pMV4N.7286$pgLd.6741@fx05.iad>
<uj1jli$1kdmu$1@raubtier-asyl.eternal-september.org>
<88V5N.33567$Ee89.15971@fx17.iad>
<uj99na$35s1q$1@raubtier-asyl.eternal-september.org>
<CS66N.35203$cAm7.7747@fx18.iad> <Tb86N.7506$xeV4.1209@fx45.iad>
<20231118122549.392@kylheku.com> <20231124011442.00004937@yahoo.com>
<ujpcnq$27892$1@dont-email.me>
<ujpl4m$28aoq$4@raubtier-asyl.eternal-september.org>
<ujppo2$28srl$5@dont-email.me> <bL38N.65219$cAm7.33028@fx18.iad>
<20231124102842.71@kylheku.com>
<ujsobk$2ps2p$1@raubtier-asyl.eternal-september.org>
Injection-Date: Sat, 25 Nov 2023 18:10:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d25b649105d96d41245ac8bccef31e21";
logging-data="3042982"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ulH0ImIQlEklWsnq5vJijdwvhB2SdEbQ="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:bxsSi6DezK65osGi7ISAvzdhCgg=
 by: Kaz Kylheku - Sat, 25 Nov 2023 18:10 UTC

On 2023-11-25, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 24.11.2023 um 19:33 schrieb Kaz Kylheku:
>
>> It's just a syntactic sugar to avoid forgetting to unlock ...
>
> RAII is magnitudes more convenient and lass error-prone
> than manual resource handling.

Sure, but that's not necessarily an effective way to "sell" it to
someone who is being skeptical.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.


devel / comp.lang.c++ / A Java- / .NET-like monitor

Pages:1234567891011
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor