Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

This dungeon is owned and operated by Frobozz Magic Co., Ltd.


devel / comp.lang.c++ / Re: Thread-safe initialization of static objects

SubjectAuthor
* Thread-safe initialization of static objectsBonita Montero
+* Re: Thread-safe initialization of static objectsPavel
|+* Re: Thread-safe initialization of static objectsBonita Montero
||+* Re: Thread-safe initialization of static objectsPavel
|||`* Re: Thread-safe initialization of static objectsBonita Montero
||| `* Re: Thread-safe initialization of static objectsPavel
|||  `* Re: Thread-safe initialization of static objectsBonita Montero
|||   +* Re: Thread-safe initialization of static objectsScott Lurndal
|||   |+* Re: Thread-safe initialization of static objectsRichard Damon
|||   ||`* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   || `* Re: Thread-safe initialization of static objectsRichard Damon
|||   ||  `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   ||   +* Re: Thread-safe initialization of static objectsRichard Damon
|||   ||   |`- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   ||   `* Re: Thread-safe initialization of static objectsScott Lurndal
|||   ||    `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   |`- Re: Thread-safe initialization of static objectsBonita Montero
|||   +* Re: Thread-safe initialization of static objectsPavel
|||   |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | +* Re: Thread-safe initialization of static objectsPavel
|||   | |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | +* Re: Thread-safe initialization of static objectsPaavo Helde
|||   | | |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | +* Re: Thread-safe initialization of static objectsPavel
|||   | | | |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | +* Re: Thread-safe initialization of static objectsRichard Damon
|||   | | | | |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | +* Re: Thread-safe initialization of static objectsRichard Damon
|||   | | | | | |+* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | ||+* Re: Thread-safe initialization of static objectsPaavo Helde
|||   | | | | | |||+* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | ||||+- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | | ||||`* Re: Thread-safe initialization of static objectsPaavo Helde
|||   | | | | | |||| +* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | |||| |+- Re: Thread-safe initialization of static objectsRichard Damon
|||   | | | | | |||| |`- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | | |||| `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | ||||  `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | ||||   `* Re: Thread-safe initialization of static objectsPaavo Helde
|||   | | | | | ||||    +- Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | ||||    `- Re: Thread-safe initialization of static objectsBonita Montero
|||   | | | | | |||`* Re: Thread-safe initialization of static objectsMichael S
|||   | | | | | ||| +- Re: Thread-safe initialization of static objectsScott Lurndal
|||   | | | | | ||| `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | | ||`* Re: Thread-safe initialization of static objectsRichard Damon
|||   | | | | | || `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | | |`* Re: Thread-safe initialization of static objectsPavel
|||   | | | | | | `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | | |  `* Re: Thread-safe initialization of static objectsPavel
|||   | | | | | |   `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | | |    `- Re: Thread-safe initialization of static objectsPavel
|||   | | | | | `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | | | `- Re: Thread-safe initialization of static objectsPavel
|||   | | | `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |  `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |   +* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |   |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |   | `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |   |  +- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |   |  `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |   |   +- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |   |   `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |   +- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |   `* Re: Thread-safe initialization of static objectsRichard Damon
|||   | | |    `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |     +- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |     `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |      `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |       `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |        `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |         `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |          `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |           `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |            `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |             `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |              +- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |              `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |               `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                 `* Re: Thread-safe initialization of static objectsScott Lurndal
|||   | | |                  +- Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                  `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                   `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                    `* Re: Thread-safe initialization of static objectsRichard Damon
|||   | | |                     `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                      `* Re: Thread-safe initialization of static objectsPavel
|||   | | |                       `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        +* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        | `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |  `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        |   +* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |   |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        |   | +* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |   | |`* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        |   | | `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |   | |  `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        |   | |   `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |   | |    `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        |   | |     `* Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |   | |      `* Re: Thread-safe initialization of static objectsBonita Montero
|||   | | |                        |   | `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | | |                        |   `* Re: Thread-safe initialization of static objectsKaz Kylheku
|||   | | |                        `* Re: Thread-safe initialization of static objectsPavel
|||   | | `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   | `- Re: Thread-safe initialization of static objectsChris M. Thomasson
|||   `- Re: Thread-safe initialization of static objectsMarcel Mueller
||`- Re: Thread-safe initialization of static objectsChris M. Thomasson
|`* Re: Thread-safe initialization of static objectsChris M. Thomasson
+* Re: Thread-safe initialization of static objectsPaavo Helde
+* Re: Thread-safe initialization of static objectsChris M. Thomasson
+* Re: Thread-safe initialization of static objectsChris M. Thomasson
`* Re: Thread-safe initialization of static objectsFrederick Virchanza Gotham

Pages:123456789101112131415161718192021222324252627
Re: Thread-safe initialization of static objects

<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:622a:1909:b0:412:16d9:f0f1 with SMTP id w9-20020a05622a190900b0041216d9f0f1mr29401qtc.6.1695554302783;
Sun, 24 Sep 2023 04:18:22 -0700 (PDT)
X-Received: by 2002:a9d:664b:0:b0:6af:9f8b:c606 with SMTP id
q11-20020a9d664b000000b006af9f8bc606mr1274735otm.0.1695554302527; Sun, 24 Sep
2023 04:18:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Sun, 24 Sep 2023 04:18:22 -0700 (PDT)
In-Reply-To: <ueoqra$19436$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me> <ueoqra$19436$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Sun, 24 Sep 2023 11:18:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2406
 by: Michael S - Sun, 24 Sep 2023 11:18 UTC

On Sunday, September 24, 2023 at 11:09:31 AM UTC+3, Bonita Montero wrote:
> Am 24.09.2023 um 05:05 schrieb Chris M. Thomasson:
>
> > Why do you think that static initialization must use a std::mutex
> > anyway? ...
>
> It is mandated that contenders are sleeping

Really? I never had read the Standard, but somehow have troubles
believing that.
Would expect that it's matter of quality of implementations rather than
of mandate.
Even more so - requirement to wake up timely if sleeping
indeed happened. It's expected from good implementation, but
I can't believe that it's mandated by Standard.

Re: Thread-safe initialization of static objects

<uep6pj$1b36d$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 13:33:10 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <uep6pj$1b36d$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me> <MTUPM.158223$Hih7.125749@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 11:33:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1412301"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6mbPBFIWSr0Yie6bzQlyxF8IdHFlTMqs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:kFA9UP4h3U88rlhXb/e7bsrjQoQ=
Content-Language: de-DE
In-Reply-To: <MTUPM.158223$Hih7.125749@fx11.iad>
 by: Bonita Montero - Sun, 24 Sep 2023 11:33 UTC

Am 24.09.2023 um 13:15 schrieb Richard Damon:

> So, you still think that the Standard should allow a very common
> operation to fail in ways that the program can not handle it when
> another method exists to do the operation exists that has no
> opportunity for failure.

The program could easily handle that by catching a system_error.
There's nothing different from that if the constructor itself
throws an error.

Re: Thread-safe initialization of static objects

<uep6ss$1b36d$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 13:34:55 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uep6ss$1b36d$2@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 11:34:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1412301"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NCvG22Hd6zM9NBO3eg67dpKe+onNLuuI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:H/X+NPNOhziidY9iWPLnXKIq/bA=
Content-Language: de-DE
In-Reply-To: <aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
 by: Bonita Montero - Sun, 24 Sep 2023 11:34 UTC

Am 24.09.2023 um 13:18 schrieb Michael S:

> Really? I never had read the Standard, but somehow have troubles
> believing that.

Someone here cited the standard with that. Everything different
like spinning (not applicable in userspace) would be unprofessional.

Re: Thread-safe initialization of static objects

<01f149e4-8312-412a-a248-9c343f989c14n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:ac8:4e81:0:b0:415:15f9:c070 with SMTP id 1-20020ac84e81000000b0041515f9c070mr34704qtp.6.1695556210772;
Sun, 24 Sep 2023 04:50:10 -0700 (PDT)
X-Received: by 2002:a05:6871:6aa9:b0:1d5:a24a:c33 with SMTP id
zf41-20020a0568716aa900b001d5a24a0c33mr1761668oab.8.1695556210480; Sun, 24
Sep 2023 04:50:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Sun, 24 Sep 2023 04:50:10 -0700 (PDT)
In-Reply-To: <uep6ss$1b36d$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me> <aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <01f149e4-8312-412a-a248-9c343f989c14n@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Sun, 24 Sep 2023 11:50:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2914
 by: Michael S - Sun, 24 Sep 2023 11:50 UTC

On Sunday, September 24, 2023 at 2:35:09 PM UTC+3, Bonita Montero wrote:
> Am 24.09.2023 um 13:18 schrieb Michael S:
>
> > Really? I never had read the Standard, but somehow have troubles
> > believing that.
> Someone here cited the standard with that. Everything different
> like spinning (not applicable in userspace) would be unprofessional.

Can I conclude that you also didn't read the Standard?

As to what is professional and what not, it's matter of opinion
and circumstances. After all, we are talking about rare situation
during use of obscure language feature. On Linux or post-XP Windows
it is easy to be both robust and performant. But if platform in question
does not provide obvious both robust and performant way of dealing with
it, then many people, including myself, would prefer robust solution
over performant one. I.e. we will take a solution in which late comers are
waiting on done flag ina loop with Sleep(1) over dynamic allocation
of kernel object that can theoretically fail.

Re: Thread-safe initialization of static objects

<uep831$1b9af$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 13:55:16 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uep831$1b9af$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me>
<01f149e4-8312-412a-a248-9c343f989c14n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 11:55:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1418575"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TCVL5GlW1xdDw1Wpq11eQpv/toh8AdnA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:KBCCtiRevwzKhlx5nHxjAhZrjr0=
In-Reply-To: <01f149e4-8312-412a-a248-9c343f989c14n@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Sun, 24 Sep 2023 11:55 UTC

Am 24.09.2023 um 13:50 schrieb Michael S:

> As to what is professional and what not, it's matter of opinion
> and circumstances. ...

The implementation can't estimate how long a static initialization
takes. If it takes a longer time spinning would be a real problem.
Yielding would also be not ok because the contenders may wait longer
than necessary under load conditions or if not, may actually spin
and consume unecessary power. So a semaphore is the only solution
that makes sense.

Re: Thread-safe initialization of static objects

<byVPM.165856$Hih7.109980@fx11.iad>

  copy mid

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

  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!fx11.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Thread-safe initialization of static objects
Content-Language: en-US
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me> <MTUPM.158223$Hih7.125749@fx11.iad>
<uep6pj$1b36d$1@dont-email.me>
From: Richard@Damon-Family.org (Richard Damon)
In-Reply-To: <uep6pj$1b36d$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 17
Message-ID: <byVPM.165856$Hih7.109980@fx11.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Sun, 24 Sep 2023 08:01:10 -0400
X-Received-Bytes: 2181
 by: Richard Damon - Sun, 24 Sep 2023 12:01 UTC

On 9/24/23 7:33 AM, Bonita Montero wrote:
> Am 24.09.2023 um 13:15 schrieb Richard Damon:
>
>> So, you still think that the Standard should allow a very common
>> operation to fail in ways that the program can not handle it when
>> another method exists to do the operation exists that has no
>> opportunity for failure.
>
> The program could easily handle that by catching a system_error.
> There's nothing different from that if the constructor itself
> throws an error.
>

But it shouldn't NEED to, since the operation can be done without the
possibility of error.

And, for non-local initialization, it CAN'T.

Re: Thread-safe initialization of static objects

<YAVPM.165857$Hih7.40004@fx11.iad>

  copy mid

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

  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!fx11.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Thread-safe initialization of static objects
Content-Language: en-US
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me>
From: Richard@Damon-Family.org (Richard Damon)
In-Reply-To: <uep6ss$1b36d$2@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 20
Message-ID: <YAVPM.165857$Hih7.40004@fx11.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Sun, 24 Sep 2023 08:04:07 -0400
X-Received-Bytes: 2108
 by: Richard Damon - Sun, 24 Sep 2023 12:04 UTC

On 9/24/23 7:34 AM, Bonita Montero wrote:
> Am 24.09.2023 um 13:18 schrieb Michael S:
>
>> Really? I never had read the Standard, but somehow have troubles
>> believing that.
>
> Someone here cited the standard with that. Everything different
> like spinning (not applicable in userspace) would be unprofessional.
>

Nope, Try to find it.

You are just showing you don't understand what you are talking about.

In fact, using a mutex the way you are decribing, because it can fail,
in "unprofessional", and more importantly, non-conforming.

Demanding that specification change because YOU don't see how to meet
them is very much "unprofessional"

Re: Thread-safe initialization of static objects

<uep8vu$1bect$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 14:10:41 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uep8vu$1bect$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me> <MTUPM.158223$Hih7.125749@fx11.iad>
<uep6pj$1b36d$1@dont-email.me> <byVPM.165856$Hih7.109980@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 12:10:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1423773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VF3S++w5iwP5jsOGMn8DpEKWuBqKF9p0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:guMb35ud1j5VvIs82lavDkOzysw=
Content-Language: de-DE
In-Reply-To: <byVPM.165856$Hih7.109980@fx11.iad>
 by: Bonita Montero - Sun, 24 Sep 2023 12:10 UTC

Am 24.09.2023 um 14:01 schrieb Richard Damon:

> But it shouldn't NEED to, since the operation can be done without the
> possibility of error.

That isn't guaranteed for any platform.

> And, for non-local initialization, it CAN'T.

Non-local initializations are done before main() or before the
shared object initialization returns and therefore they don't
need any synchronization.

Re: Thread-safe initialization of static objects

<uep94g$1bect$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 14:13:07 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uep94g$1bect$2@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me> <YAVPM.165857$Hih7.40004@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 12:13:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1423773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TuF10LWoK9SaMl+9acLO9TOeTB2WY6bE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:l/mGT7vv4EGUcCLoXjS4xpDMg+U=
In-Reply-To: <YAVPM.165857$Hih7.40004@fx11.iad>
Content-Language: de-DE
 by: Bonita Montero - Sun, 24 Sep 2023 12:13 UTC

Am 24.09.2023 um 14:04 schrieb Richard Damon:

> In fact, using a mutex the way you are decribing, because it can
> fail, in "unprofessional", and more importantly, non-conforming.

Yielding is unacceptable and the only second solution that sleeps,
as the standard mandates. I don't understand what would be the
problem to have a system_error on a synchronization failure with
static initialization.

Re: Thread-safe initialization of static objects

<e8fd5306-78bb-4e6b-b2a3-51060be3ad9fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:620a:17a4:b0:773:f15d:3c07 with SMTP id ay36-20020a05620a17a400b00773f15d3c07mr90801qkb.3.1695558118806; Sun, 24 Sep 2023 05:21:58 -0700 (PDT)
X-Received: by 2002:a05:6808:14d4:b0:3ad:f525:52bf with SMTP id f20-20020a05680814d400b003adf52552bfmr2516269oiw.1.1695558118616; Sun, 24 Sep 2023 05:21:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.15.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Sun, 24 Sep 2023 05:21:58 -0700 (PDT)
In-Reply-To: <uep94g$1bect$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad> <ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad> <ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad> <ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad> <uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad> <uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad> <uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad> <uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad> <uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me> <ueoqra$19436$2@dont-email.me> <aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com> <uep6ss$1b36d$2@dont-email.me> <YAVPM.165857$Hih7.40004@fx11.iad> <uep94g$1bect$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e8fd5306-78bb-4e6b-b2a3-51060be3ad9fn@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Sun, 24 Sep 2023 12:21:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 14
 by: Michael S - Sun, 24 Sep 2023 12:21 UTC

On Sunday, September 24, 2023 at 3:13:21 PM UTC+3, Bonita Montero wrote:
> Am 24.09.2023 um 14:04 schrieb Richard Damon:
>
> > In fact, using a mutex the way you are decribing, because it can
> > fail, in "unprofessional", and more importantly, non-conforming.
> Yielding is unacceptable and the only second solution that sleeps,
> as the standard mandates. I don't understand what would be the
> problem to have a system_error on a synchronization failure with
> static initialization.

I am not an expert in C++ Standard advocacy, rather close to
opposite of, but I can guess. Throwing system_error will create
an illusion of possibility of useful recovery where in reality useful
recovery is impossible.

Re: Thread-safe initialization of static objects

<uepaeh$1blsi$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 14:35:32 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uepaeh$1blsi$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me> <YAVPM.165857$Hih7.40004@fx11.iad>
<uep94g$1bect$2@dont-email.me>
<e8fd5306-78bb-4e6b-b2a3-51060be3ad9fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 12:35:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1431442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+j3IVPOyH03P/r4ROQ22ACu/HIn6vnLak="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:BrC7CBQrUX2ATrl3Um6//58Ld7A=
Content-Language: de-DE
In-Reply-To: <e8fd5306-78bb-4e6b-b2a3-51060be3ad9fn@googlegroups.com>
 by: Bonita Montero - Sun, 24 Sep 2023 12:35 UTC

Am 24.09.2023 um 14:21 schrieb Michael S:

> I am not an expert in C++ Standard advocacy, rather close to
> opposite of, but I can guess. Throwing system_error will create
> an illusion of possibility of useful recovery where in reality
> useful recovery is impossible.

This depends on the code you write if this is acceptable. Sometimes
there's also not a useful recovery when a thread responding to another
thread fails to lock a mutex, thereby letting the other thread waiting
forever; nevertheless there's a system_error with that.

Re: Thread-safe initialization of static objects

<7fae3a03-f568-4482-88a6-ffd93cb87524n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:ac8:5b87:0:b0:412:233d:39dc with SMTP id a7-20020ac85b87000000b00412233d39dcmr36426qta.0.1695559661049;
Sun, 24 Sep 2023 05:47:41 -0700 (PDT)
X-Received: by 2002:a05:6870:b68a:b0:1dc:fc5f:5f6b with SMTP id
cy10-20020a056870b68a00b001dcfc5f5f6bmr1637695oab.7.1695559660754; Sun, 24
Sep 2023 05:47:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Sun, 24 Sep 2023 05:47:40 -0700 (PDT)
In-Reply-To: <uepaeh$1blsi$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:859c:9294:d188:1b63
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me> <aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me> <YAVPM.165857$Hih7.40004@fx11.iad>
<uep94g$1bect$2@dont-email.me> <e8fd5306-78bb-4e6b-b2a3-51060be3ad9fn@googlegroups.com>
<uepaeh$1blsi$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7fae3a03-f568-4482-88a6-ffd93cb87524n@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Sun, 24 Sep 2023 12:47:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2864
 by: Michael S - Sun, 24 Sep 2023 12:47 UTC

On Sunday, September 24, 2023 at 3:35:46 PM UTC+3, Bonita Montero wrote:
> Am 24.09.2023 um 14:21 schrieb Michael S:
>
> > I am not an expert in C++ Standard advocacy, rather close to
> > opposite of, but I can guess. Throwing system_error will create
> > an illusion of possibility of useful recovery where in reality
> > useful recovery is impossible.
> This depends on the code you write if this is acceptable. Sometimes
> there's also not a useful recovery when a thread responding to another
> thread fails to lock a mutex, thereby letting the other thread waiting
> forever; nevertheless there's a system_error with that.

I don't say that is what should be done.
For me, calling abort() with as intelligible as practical error message is
what should be done on hosted implementation.

Re: Thread-safe initialization of static objects

<uepbda$1brdd$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 14:51:57 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uepbda$1brdd$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me> <YAVPM.165857$Hih7.40004@fx11.iad>
<uep94g$1bect$2@dont-email.me>
<e8fd5306-78bb-4e6b-b2a3-51060be3ad9fn@googlegroups.com>
<uepaeh$1blsi$1@dont-email.me>
<7fae3a03-f568-4482-88a6-ffd93cb87524n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 12:51:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eb27cf8260b077e260d32247752bc17";
logging-data="1437101"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Zs+BtYAtOJYtM1cA8y3JeUQPyXJxoZzs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:rnBkQmjXQJ36DYSA92oN+MWKriQ=
Content-Language: de-DE
In-Reply-To: <7fae3a03-f568-4482-88a6-ffd93cb87524n@googlegroups.com>
 by: Bonita Montero - Sun, 24 Sep 2023 12:51 UTC

Am 24.09.2023 um 14:47 schrieb Michael S:

> I don't say that is what should be done.
> For me, calling abort() with as intelligible as practical error message is
> what should be done on hosted implementation.

I _sometimes_ call terminate() on synchronization errors also, f.e. when
a threads responds back to a thread which issued a task to this thread
to prevent starving the other thread. But with the issuing thread first
I don't terminate(). It simply depends on the situation and with static
initialization it's the same.

Re: Thread-safe initialization of static objects

<ec0fee61-1e6d-4b8c-9fe7-62ed5c7cceeen@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:622a:1a0a:b0:3fd:df16:18f4 with SMTP id f10-20020a05622a1a0a00b003fddf1618f4mr36504qtb.8.1695560256889;
Sun, 24 Sep 2023 05:57:36 -0700 (PDT)
X-Received: by 2002:a05:6830:1098:b0:6bd:c20:4215 with SMTP id
y24-20020a056830109800b006bd0c204215mr1475922oto.7.1695560256498; Sun, 24 Sep
2023 05:57:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Sun, 24 Sep 2023 05:57:36 -0700 (PDT)
In-Reply-To: <jBoPM.25452$fUu6.14009@fx47.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=104.247.242.226; posting-account=3E3pbwoAAAAXIx5awOqPnLzD9t84gci2
NNTP-Posting-Host: 104.247.242.226
References: <udafjf$2joeq$1@dont-email.me> <ue4t6i$3um57$1@dont-email.me>
<ue5sp2$7ms9$1@dont-email.me> <ue7gb8$fumm$3@dont-email.me>
<ue7gkn$g3o5$1@dont-email.me> <20230917121015.206@kylheku.com>
<ue7k2n$gmqv$1@dont-email.me> <20230917123203.524@kylheku.com>
<ue8lst$q25a$2@dont-email.me> <20230918101705.91@kylheku.com>
<uea1rj$1saml$1@dont-email.me> <hK5OM.30729$Yxl8.9621@fx14.iad>
<ueb3f7$2638l$2@dont-email.me> <ueb9vm$271en$3@dont-email.me>
<uebn4f$293m3$2@dont-email.me> <1GhOM.7399$H0Ge.6907@fx05.iad>
<uecac1$2cj86$1@dont-email.me> <iwpOM.265$Sn81.181@fx08.iad>
<uedp93$2orvq$2@dont-email.me> <k4BOM.2058$TwR4.78@fx46.iad>
<ueeret$2upib$1@dont-email.me> <JCKOM.83797$2ph4.24937@fx14.iad>
<uege3r$3bfsj$2@dont-email.me> <ueggh5$3bq3f$1@dont-email.me>
<uegsdo$3dj0r$1@dont-email.me> <uei1g6$3l13h$2@dont-email.me>
<ueiu42$3tima$1@dont-email.me> <eE7PM.16350$3vM.3605@fx37.iad>
<uej5q1$3uji0$1@dont-email.me> <gWePM.25327$fUu6.21270@fx47.iad>
<uek0g4$7fl1$1@dont-email.me> <jBoPM.25452$fUu6.14009@fx47.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec0fee61-1e6d-4b8c-9fe7-62ed5c7cceeen@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: danielaparker@gmail.com (Daniel)
Injection-Date: Sun, 24 Sep 2023 12:57:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2496
 by: Daniel - Sun, 24 Sep 2023 12:57 UTC

On Friday, September 22, 2023 at 6:32:02 PM UTC-4, Richard Damon wrote:
> >
> The fact that you are too stupid

Perhaps Richard could reflect on the fact that with regard to manners and
civility, he's also as stupid as they come. Something to work on. The
heavyweights that used to post here never had that problem.

Best regards,
Daniel

Re: Thread-safe initialization of static objects

<uepo2a$1du2j$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuyper@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 12:27:54 -0400
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <uepo2a$1du2j$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me> <YAVPM.165857$Hih7.40004@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 16:27:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="02f9defeecc8712da321e422f8c6bcdf";
logging-data="1505363"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bwLx30S4Ou9PUT6YsyH6X3z4JdtLqNLU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:Ts35eK5wEZRWf4BQGeZES2g7Gsg=
In-Reply-To: <YAVPM.165857$Hih7.40004@fx11.iad>
Content-Language: en-US
 by: James Kuyper - Sun, 24 Sep 2023 16:27 UTC

On 9/24/23 08:04, Richard Damon wrote:
> On 9/24/23 7:34 AM, Bonita Montero wrote:
....
>> Someone here cited the standard with that. Everything different
>> like spinning (not applicable in userspace) would be unprofessional.
>>
>
> Nope, Try to find it.
>
>
> You are just showing you don't understand what you are talking about.
>
> In fact, using a mutex the way you are decribing, because it can fail,
> in "unprofessional", and more importantly, non-conforming.
>
> Demanding that specification change because YOU don't see how to meet
> them is very much "unprofessional"

No, it is very professional to complain about specifications that can't
be met. What is unprofessional is incorrectly concluding that they
cannot be met (especially after having had it explained to you many times).

Re: Thread-safe initialization of static objects

<7b90d532-4d13-3d4c-f9d6-3d9c964c988c@removeyourself.dontspam.yahoo>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me>
From: pauldontspamtolk@removeyourself.dontspam.yahoo (Pavel)
Message-ID: <7b90d532-4d13-3d4c-f9d6-3d9c964c988c@removeyourself.dontspam.yahoo>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <ueoqpa$19436$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 23
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 24 Sep 2023 16:46:08 UTC
Date: Sun, 24 Sep 2023 12:46:02 -0400
X-Received-Bytes: 2585
 by: Pavel - Sun, 24 Sep 2023 16:46 UTC

Bonita Montero wrote:
> Am 24.09.2023 um 04:22 schrieb Kaz Kylheku:
>
>> A possible design is that each *thread* has a wait semaphore.
>
> You'd have to register the binary semaphore and register as a waiter in
> one atomic step. You could do that with a DCAS'd ring, but you coudn't
> atomically update the link pointers of the other nodes at the same
> time you update the roots link pointers. And you would have the deallo-
> cation poblem, i.e. the memory of your object may never be deallocated.
> Show me your implementation !
> It's ridiculous because mutex are a cheap resource.
Cheap as compared to what? How is a mutex "cheaper" than other
synchronization primitives? Also, what exactly mutex operation(s) is/are
cheap? Also, what exactly mutex type is cheap? On what platform? A
blanket statement is never entirely true or false, nothing can be
"ridiculous" because of it.

> And if such imple-
> mentation would be possible the standard shouldn't mandate it since
> not every platform has a DCAS.
>

Re: Thread-safe initialization of static objects

<PKZPM.232647$ZXz4.71820@fx18.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me> <MTUPM.158223$Hih7.125749@fx11.iad>
<uep6pj$1b36d$1@dont-email.me> <byVPM.165856$Hih7.109980@fx11.iad>
<uep8vu$1bect$1@dont-email.me>
From: pauldontspamtolk@removeyourself.dontspam.yahoo (Pavel)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <uep8vu$1bect$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 17
Message-ID: <PKZPM.232647$ZXz4.71820@fx18.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 24 Sep 2023 16:47:43 UTC
Date: Sun, 24 Sep 2023 12:47:43 -0400
X-Received-Bytes: 2107
 by: Pavel - Sun, 24 Sep 2023 16:47 UTC

Bonita Montero wrote:
> Am 24.09.2023 um 14:01 schrieb Richard Damon:
>
>> But it shouldn't NEED to, since the operation can be done without the
>> possibility of error.
>
> That isn't guaranteed for any platform.
Name one platform for which it is not guaranteed and that targets a
compliant C++11+ implementation.

>
>> And, for non-local initialization, it CAN'T.
>
> Non-local initializations are done before main() or before the
> shared object initialization returns and therefore they don't
> need any synchronization.

Re: Thread-safe initialization of static objects

<EQZPM.48734$tTTf.46622@fx40.iad>

  copy mid

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

  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!fx40.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<aa307383-8415-4e39-9cca-18a0f57bf6f4n@googlegroups.com>
<uep6ss$1b36d$2@dont-email.me>
From: pauldontspamtolk@removeyourself.dontspam.yahoo (Pavel)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <uep6ss$1b36d$2@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 12
Message-ID: <EQZPM.48734$tTTf.46622@fx40.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 24 Sep 2023 16:53:56 UTC
Date: Sun, 24 Sep 2023 12:53:56 -0400
X-Received-Bytes: 1857
 by: Pavel - Sun, 24 Sep 2023 16:53 UTC

Bonita Montero wrote:
> Am 24.09.2023 um 13:18 schrieb Michael S:
>
>> Really? I never had read the Standard, but somehow have troubles
>> believing that.
>
> Someone here cited the standard with that. Everything different
> like spinning (not applicable in userspace) would be unprofessional.
>
Kernel-level sleeping and waking up is more or less moving an execution
context from runlist to a waiting list and back. Why should such an
operation be fail-able?

Re: Thread-safe initialization of static objects

<RVZPM.179438$vMO8.73136@fx16.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <udpbun$1gf8c$1@dont-email.me>
<udqatg$1mar3$1@dont-email.me> <udqbg3$1mdv6$1@dont-email.me>
<udqq8u$1p3q6$1@dont-email.me> <uds0qa$22qfj$1@dont-email.me>
<udtg9s$2aqb5$1@dont-email.me> <uduimg$2imqi$1@dont-email.me>
<FUEMM.7469$ZkX3.6739@fx09.iad> <ue3bhh$3l4s1$1@dont-email.me>
<ue3nga$3ms5s$1@dont-email.me> <eohNM.4832$3lL1.1360@fx47.iad>
<ue4cqe$3rjfr$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <VnsPM.122464$Hih7.52058@fx11.iad>
<uelqeq$lo9j$4@dont-email.me> <XbJPM.157838$Hih7.40116@fx11.iad>
<ueo57s$15ub1$1@dont-email.me>
From: pauldontspamtolk@removeyourself.dontspam.yahoo (Pavel)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <ueo57s$15ub1$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 50
Message-ID: <RVZPM.179438$vMO8.73136@fx16.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 24 Sep 2023 16:59:29 UTC
Date: Sun, 24 Sep 2023 12:59:29 -0400
X-Received-Bytes: 4043
 by: Pavel - Sun, 24 Sep 2023 16:59 UTC

Chris M. Thomasson wrote:
> On 9/23/2023 2:58 PM, Pavel wrote:
>> Bonita Montero wrote:
>>> Am 23.09.2023 um 04:50 schrieb Pavel:
>>>
>>>> for some mutex it may fail, for some not. C++ standard never says
>>>> that std::mutex can fail. ...
>>>
>>> std::mutex::lock() can throw a system_error.
>> Wrong. The standard says that lock can throw while discussing general
>> requirements for all types of mutices (mutex, recursive_mutex,
>> timed_mutex, recursive_timed_mutex, shared_mutex, and
>> shared_timed_mutex). Then, when discussing specific mutices, the
>> standard says that recursive_mutex, recursive_timed_mutex and any of
>> the shared mutices can throw system_error). About std::mutex the
>> standard says no such thing.
>>
>> The only mentioning of an error for std::mutex is in a non-normative
>> note that explains: "If the
>> implementation can detect the deadlock, a
>> resource_deadlock_would_occur error condition might be observed". We
>> knew that already (using deadlock-detecting mutex is asking for error)
>> -- as well as that no C++ implementer would use a more complex
>> error-throwing deadlock-detecting mutex given a simpler alternative
>> for static initialization.
>>
>> In particular, on UNIX, an implementer will use
>> PTHREAD_MUTEX_INITIALIZER that initializes a non-ERRORCHECK mutex.
>>
>> On Windows, critical section is essentially a recursive
>> deadlock-detecting (timed) mutex so it is relatively expensive and can
>> fail.
> [...]
>
> I don't think there is a timed wait for a windows critical section. I
> know it has a try, but I cannot remember a timed wait...
It is not a timed wait controlled by the user. But it waits for some
time (specified in the registry) and then fails -- that is its way to
*try* to detect a deadlock. Says the doc on EnterCriticalSection:

"
This function can raise EXCEPTION_POSSIBLE_DEADLOCK, also known as
STATUS_POSSIBLE_DEADLOCK, if a wait operation on the critical section
times out. The timeout interval is specified by the following registry
value: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\CriticalSectionTimeout. Do not handle a possible deadlock
exception; instead, debug the application.
"

Re: Thread-safe initialization of static objects

<3XZPM.179439$vMO8.93801@fx16.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <udpbun$1gf8c$1@dont-email.me>
<udqatg$1mar3$1@dont-email.me> <udqbg3$1mdv6$1@dont-email.me>
<udqq8u$1p3q6$1@dont-email.me> <uds0qa$22qfj$1@dont-email.me>
<udtg9s$2aqb5$1@dont-email.me> <uduimg$2imqi$1@dont-email.me>
<FUEMM.7469$ZkX3.6739@fx09.iad> <ue3bhh$3l4s1$1@dont-email.me>
<ue3nga$3ms5s$1@dont-email.me> <eohNM.4832$3lL1.1360@fx47.iad>
<ue4cqe$3rjfr$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <VnsPM.122464$Hih7.52058@fx11.iad>
<uelqeq$lo9j$4@dont-email.me> <XbJPM.157838$Hih7.40116@fx11.iad>
<ueo5ea$162e7$1@dont-email.me>
From: pauldontspamtolk@removeyourself.dontspam.yahoo (Pavel)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <ueo5ea$162e7$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 70
Message-ID: <3XZPM.179439$vMO8.93801@fx16.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 24 Sep 2023 17:00:47 UTC
Date: Sun, 24 Sep 2023 13:00:47 -0400
X-Received-Bytes: 5052
 by: Pavel - Sun, 24 Sep 2023 17:00 UTC

Chris M. Thomasson wrote:
> On 9/23/2023 2:58 PM, Pavel wrote:
>> Bonita Montero wrote:
>>> Am 23.09.2023 um 04:50 schrieb Pavel:
>>>
>>>> for some mutex it may fail, for some not. C++ standard never says
>>>> that std::mutex can fail. ...
>>>
>>> std::mutex::lock() can throw a system_error.
>> Wrong. The standard says that lock can throw while discussing general
>> requirements for all types of mutices (mutex, recursive_mutex,
>> timed_mutex, recursive_timed_mutex, shared_mutex, and
>> shared_timed_mutex). Then, when discussing specific mutices, the
>> standard says that recursive_mutex, recursive_timed_mutex and any of
>> the shared mutices can throw system_error). About std::mutex the
>> standard says no such thing.
>>
>> The only mentioning of an error for std::mutex is in a non-normative
>> note that explains: "If the
>> implementation can detect the deadlock, a
>> resource_deadlock_would_occur error condition might be observed". We
>> knew that already (using deadlock-detecting mutex is asking for error)
>> -- as well as that no C++ implementer would use a more complex
>> error-throwing deadlock-detecting mutex given a simpler alternative
>> for static initialization.
>>
>> In particular, on UNIX, an implementer will use
>> PTHREAD_MUTEX_INITIALIZER that initializes a non-ERRORCHECK mutex.
>>
>> On Windows, critical section is essentially a recursive
>> deadlock-detecting (timed) mutex so it is relatively expensive and can
>> fail.
>>
>> All it means that, on Windows, to implement static initialization, a
>> C++ implementor has to use other primitives, most conveniently --
>> InitOnceExecuteOnce -- that cannot fail unless the callback it
>> executes fails.
>>
>>>
>>>> "delayed" or "deferred" initialization of synchronization primitives
>>>> that can be used to initialize static C++ object is entirely your
>>>> fantasy. It cannot be used for this purpose, period.
>>>
>>> The mutex' constructor doesn't throw, so there must be delayed
>>> initialization.
>> Wrong. a mutex can be created during static initialization entirely in
>> user space (like POSIX mutex on linux is created)
>>
>>> But as we've seen recently pthread Mutexes also
>>> allow delayed initialization
>> "Allow" does not mean C++ static initialization implementer has to use
>> it. On Linux, mutex_lock tries light-weight user-space initialization
>> internally so no need to reinvent that wheel for implementers. But of
>> course on Linux any reasonable implementer will use pthread_once
>> (which also does not have any delayed iniitialization), rather than a
>> mutex.
>>
>>>  of the slow path and Win32 always
>>> does the same.
>> Yes, on Win32 C++ static initialization does not have to use mutex
>> either. INIT_ONCE can be initialized statically to
>> INIT_ONCE_STATIC_INIT -- which is all one needs for static
>> initialization (coincidentally, on Win32 specifically
>> InitOnceInitialize does not fail either but this is irrelevant to the
>> issue of static C++ initialization).
>
> Iirc, I think a windows critical section might raise an error if its
> been waiting for 30 days or something, deadlocked.
Exactly, that's what I meant, just cited in the other response. It is,
by behavior, a timed recursive mutex but user does not control the time.

Re: Thread-safe initialization of static objects

<20230924092501.340@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 17:04:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <20230924092501.340@kylheku.com>
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me>
Injection-Date: Sun, 24 Sep 2023 17:04:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="de7138e0de32fc51e80c05ed2d00fab7";
logging-data="1524931"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Q4sT+6B3SzJSMY5szwgjeBUfaGABOQ5U="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:m3TCl2YaPdn5ooKQX+JIIbKA8n0=
 by: Kaz Kylheku - Sun, 24 Sep 2023 17:04 UTC

On 2023-09-24, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 24.09.2023 um 04:22 schrieb Kaz Kylheku:
>
>> A possible design is that each *thread* has a wait semaphore.
>
> You'd have to register the binary semaphore and register as a waiter in
> one atomic step. You could do that with a DCAS'd ring, but you coudn't
> atomically update the link pointers of the other nodes at the same
> time you update the roots link pointers. And you would have the deallo-
> cation poblem, i.e. the memory of your object may never be deallocated.

Now you're just throwing together words you don't understand.

> Show me your implementation !

E.g. old LinuxThreads in glibc, circa 2000:

https://sourceware.org/git/?p=glibc.git;a=blob;f=linuxthreads/spinlock.c;h=5cd772602c8858edd8238e73eefcbf2758935d74;hb=d82e4c7bb231c9e0f835bd46467563ac3b56cebe

The low level __pthread_lock and __pthread_unlock functions maintain a
queue, using a single-word atomic CAS.

There are suspend() and resume() functions for the waiting;
they are elsewhere.

If you look in restart.h you can see that those operations are defined
in two different ways, both of which use signals (not a semaphore per
thread). A suspending thread waits for the arrival of a signal,
resume is done by sending a signal. That's kind of semaphore-like;
and POSIX real-time signals can even queue up, like a counting sem.

> It's ridiculous because mutex are a cheap resource. And if such imple-
> mentation would be possible the standard shouldn't mandate it since
> not every platform has a DCAS.

Things can be done in ways you havn't thought about.

Atomic operations aren't required to achieve mutual exclusion among
processors that share memory.

As someone continually insisting on having expertise in concurrency,
you must be familiar with the research work of Leslie Lamport?

For instance, the paper _A Fast Mutual Exclusion Algorithm_ [1985].

Abstract:

"A new solution to the mutual exclusion problem is presented that, in the
absence of contention, requires only seven memory accesses. It assumes
atomic reads and atomic writes to shared registers."

Snipeet from Introduction which gives a clue as to the motivation:

"Recently, there has arisen interest in building shared-memory
multiprocessor computers by connecting standard processors and
memories, with as little modification to the hardware as possible.
Because ordinary sequential processors and memories do not have atomic
test-and-set operations, it is worth investigating whether
shared-memory mutual exclusion algorithms are a practical alternative."

--
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: Thread-safe initialization of static objects

<Y3_PM.16749$E_d1.14707@fx04.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx04.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$1@dont-email.me> <udpbun$1gf8c$1@dont-email.me>
<udqatg$1mar3$1@dont-email.me> <udqbg3$1mdv6$1@dont-email.me>
<udqq8u$1p3q6$1@dont-email.me> <uds0qa$22qfj$1@dont-email.me>
<udtg9s$2aqb5$1@dont-email.me> <uduimg$2imqi$1@dont-email.me>
<FUEMM.7469$ZkX3.6739@fx09.iad> <ue3bhh$3l4s1$1@dont-email.me>
<ue3nga$3ms5s$1@dont-email.me> <eohNM.4832$3lL1.1360@fx47.iad>
<ue4cqe$3rjfr$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <VnsPM.122464$Hih7.52058@fx11.iad>
<uelqeq$lo9j$4@dont-email.me> <XbJPM.157838$Hih7.40116@fx11.iad>
<ueo5ps$163k0$1@dont-email.me>
From: pauldontspamtolk@removeyourself.dontspam.yahoo (Pavel)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <ueo5ps$163k0$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 38
Message-ID: <Y3_PM.16749$E_d1.14707@fx04.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 24 Sep 2023 17:10:16 UTC
Date: Sun, 24 Sep 2023 13:10:15 -0400
X-Received-Bytes: 3040
 by: Pavel - Sun, 24 Sep 2023 17:10 UTC

Bonita Montero wrote:
> Am 23.09.2023 um 23:58 schrieb Pavel:
>
>>> std::mutex::lock() can throw a system_error.
>
>> Wrong. The standard says that lock can throw while discussing general
>> requirements for all types of mutices (mutex, recursive_mutex,
>> timed_mutex, recursive_timed_mutex, shared_mutex, and
>> shared_timed_mutex). Then, when discussing specific mutices, the
>> standard says that recursive_mutex, recursive_timed_mutex and any of
>> the shared mutices can throw system_error). About std::mutex the
>> standard says no such thing.
>
> constexpr mutex() noexcept;
>
> https://en.cppreference.com/w/cpp/thread/mutex/mutex
so? everyone has been telling you initialization of simple mutices does
not fail. After few hundred posts, you decided to agree?

>
>> Wrong. a mutex can be created during static initialization entirely
>> in user space (like POSIX mutex on linux is created)
>
> If the mutex' constructor is noexcept the kernel-part for the slow
> path has to be initialized delayed while locking.
You can rename your favorite part of locking "initialization" for your
internal use; but it is advisable to use standard terms if you write for
others.

Regardless of how it is called, no part of simple mutex lock has to be
fail-able.

>
> Rest unread.
yet another broken promise

Re: Thread-safe initialization of static objects

<uepvfk$1ff81$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 11:34:27 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uepvfk$1ff81$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <LwlNM.50924$QShe.20423@fx11.iad>
<ue4p5v$3truj$1@dont-email.me> <EjoNM.17221$DXgc.9861@fx36.iad>
<ue5tfc$7pns$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <20230922111441.730@kylheku.com>
<uelq9h$lo9j$2@dont-email.me> <20230923041951.728@kylheku.com>
<uemlbj$pl2d$1@dont-email.me> <20230923185708.811@kylheku.com>
<ueoqpa$19436$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 18:34:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4cc3e7dd6bc9b0456f53a6522e03ebcd";
logging-data="1555713"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19y1ZypPD4tc9ilzo4fZ2NOLj/6AQWzO5Q="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:6BgzpG7iM7889SlxsSEQiO5Srvk=
Content-Language: en-US
In-Reply-To: <ueoqpa$19436$1@dont-email.me>
 by: Chris M. Thomasson - Sun, 24 Sep 2023 18:34 UTC

On 9/24/2023 1:08 AM, Bonita Montero wrote:
> Am 24.09.2023 um 04:22 schrieb Kaz Kylheku:
>
>> A possible design is that each *thread* has a wait semaphore.
>
> You'd have to register the binary semaphore and register as a waiter in
> one atomic step. You could do that with a DCAS'd ring, but you coudn't
> atomically update the link pointers of the other nodes at the same
> time you update the roots link pointers. And you would have the deallo-
> cation poblem, i.e. the memory of your object may never be deallocated.
> Show me your implementation !
> It's ridiculous because mutex are a cheap resource. And if such imple-
> mentation would be possible the standard shouldn't mandate it since
> not every platform has a DCAS.
>

Pardon my French, but that is a rather horrible idea, for several reasons...

Re: Thread-safe initialization of static objects

<uepvjr$1ff81$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 11:36:43 -0700
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uepvjr$1ff81$2@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Sep 2023 18:36:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4cc3e7dd6bc9b0456f53a6522e03ebcd";
logging-data="1555713"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7wZ298o39Nuv8/gXSjjpzbG3IVCEAEFk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:CeOIPryYoGxZvPT+uCFhH4x4mz4=
Content-Language: en-US
In-Reply-To: <ueoqra$19436$2@dont-email.me>
 by: Chris M. Thomasson - Sun, 24 Sep 2023 18:36 UTC

On 9/24/2023 1:09 AM, Bonita Montero wrote:
> Am 24.09.2023 um 05:05 schrieb Chris M. Thomasson:
>
>> Why do you think that static initialization must use a std::mutex
>> anyway? ...
>
> Call it std::mutex or whatever. It is mandated that contenders
> are sleeping - that's not possible without sth. else than a mutex.
>
>

You lost me here.

Re: Thread-safe initialization of static objects

<uepvs7$1ff81$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Sun, 24 Sep 2023 11:41:11 -0700
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uepvs7$1ff81$3@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <zPGNM.14021$BMnd.11871@fx04.iad>
<ue7f6g$frod$2@dont-email.me> <LWINM.13017$ZkX3.12109@fx09.iad>
<ue8mn0$q534$4@dont-email.me> <uY5OM.30730$Yxl8.13078@fx14.iad>
<ueb3sb$2638l$6@dont-email.me> <ZjMOM.9398$EIy4.4982@fx48.iad>
<uegsia$3dj0r$2@dont-email.me> <fp7PM.104556$GHI6.80009@fx17.iad>
<uej631$3uji0$4@dont-email.me> <mzkPM.16155$ugs.3977@fx36.iad>
<uekler$bqj8$1@dont-email.me> <IsoPM.20139$wO91.15127@fx39.iad>
<uelqb1$lo9j$3@dont-email.me> <24DPM.126389$Hih7.28245@fx11.iad>
<uemvt2$rcgo$1@dont-email.me> <ueo915$16kh3$2@dont-email.me>
<ueoqra$19436$2@dont-email.me>
<37dbe3b6-ead0-487b-884c-197124888eben@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Sep 2023 18:41:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4cc3e7dd6bc9b0456f53a6522e03ebcd";
logging-data="1555713"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Gi6YNQdvl5p9uGq9gnN4WfhkkgKJcMXg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:hkKWY37e2AqfNtC2++NdQTyzfm0=
In-Reply-To: <37dbe3b6-ead0-487b-884c-197124888eben@googlegroups.com>
Content-Language: en-US
 by: Chris M. Thomasson - Sun, 24 Sep 2023 18:41 UTC

On 9/24/2023 2:50 AM, Michael S wrote:
> On Sunday, September 24, 2023 at 11:09:31 AM UTC+3, Bonita Montero wrote:
>> Am 24.09.2023 um 05:05 schrieb Chris M. Thomasson:
>>
>>> Why do you think that static initialization must use a std::mutex
>>> anyway? ...
>>
>> Call it std::mutex or whatever. It is mandated that contenders
>> are sleeping - that's not possible without sth. else than a mutex.
>
> Few dozens posts above I demonstrated an implementation
> for pre-Vista Windows where contenders are sleeping just fine and
> waking just fine and initialization of different objects proceeds
> simultaneously just fine. And it does not use mutex for that.
> It uses SleepEx() for wait and QueueUserApc() for wakeup.

Why? APC's open up a big can of worms.

> It uses one global mutex (in form of critical section) for a short
> while for metadata updates, but that's done for simplicity and
> practicality rather than out of necessity. I am pretty sure that
> with enough effort I can device a variant that achieves the same
> with CaS.


devel / comp.lang.c++ / Re: Thread-safe initialization of static objects

Pages:123456789101112131415161718192021222324252627
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor