Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

There are bugs and then there are bugs. And then there are bugs. -- Karl Lehenbauer


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

<S%pRM.268878$2ph4.195852@fx14.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
Subject: Re: Thread-safe initialization of static objects
Newsgroups: comp.lang.c++
References: <udafjf$2joeq$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> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me> <eJCQM.35600$ugs.8334@fx36.iad>
<ueutjo$2ii89$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.1
MIME-Version: 1.0
In-Reply-To: <ueutjo$2ii89$2@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 15
Message-ID: <S%pRM.268878$2ph4.195852@fx14.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Fri, 29 Sep 2023 01:46:26 UTC
Date: Thu, 28 Sep 2023 21:46:26 -0400
X-Received-Bytes: 1956
 by: Pavel - Fri, 29 Sep 2023 01:46 UTC

Bonita Montero wrote:
> Am 26.09.2023 um 17:24 schrieb Scott Lurndal:
>
>> No, it is not.Ā Ā  The kernel simply moves the waiter thread to
>> a non-runnable queue in the dispatcher until a call to 'unlock'
>> determines that there is a waiter and tells the kernel to
>> awaken it.
>
> The userspace code must tell the kernel what it its waiting for.
> Mutexes are always a combination of an atomic for the fast path
> and a binary semapohre for the slow path.
>
see my or Kaz's explanation for how it is done without allocating any
kernel resource on either initialization or locking, either fast or slow
path.

Re: Thread-safe initialization of static objects

<uf5ae6$3unn6$2@dont-email.me>

  copy mid

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

  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: Thu, 28 Sep 2023 18:48:53 -0700
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uf5ae6$3unn6$2@dont-email.me>
References: <udafjf$2joeq$1@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> <Y3_PM.16749$E_d1.14707@fx04.iad>
<ueqfec$1i6un$1@dont-email.me> <mLqQM.164530$1B%c.83768@fx09.iad>
<ueu52o$2dv5f$1@dont-email.me> <1tzQM.252985$2ph4.238002@fx14.iad>
<ueuj3l$2gdqk$1@dont-email.me> <8KCQM.35601$ugs.6585@fx36.iad>
<ueutfg$2ihvn$1@dont-email.me> <4WpRM.268869$2ph4.65476@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 01:48:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="4153062"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oGJwk0dvt9YYamQO15YowlOrPs0xERR8="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:q3cOc85SL0wro0vbVMKYJSS9NQU=
Content-Language: en-US
In-Reply-To: <4WpRM.268869$2ph4.65476@fx14.iad>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 01:48 UTC

On 9/28/2023 6:40 PM, Pavel wrote:
> Bonita Montero wrote:
>> Am 26.09.2023 um 17:25 schrieb Scott Lurndal:
>>
>>> No, there is no delayed initialization with pthread mutexes.
>>
>> There must be since you can't create a semaphore by pure assignment.
>>
> See mine or earlier Kaz's explanations above for how you actually can do
> it (and how, iirc, it is done on Linux).

Right.

Re: Thread-safe initialization of static objects

<uf5ahe$3unn6$3@dont-email.me>

  copy mid

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

  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: Thu, 28 Sep 2023 18:50:38 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uf5ahe$3unn6$3@dont-email.me>
References: <udafjf$2joeq$1@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> <Y3_PM.16749$E_d1.14707@fx04.iad>
<ueqfec$1i6un$1@dont-email.me> <40iQM.146456$bmw6.71801@fx10.iad>
<uesc36$20j2u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 29 Sep 2023 01:50:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="4153062"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180kyjQkBR9XcfK93FeUgIFeLJUqTirqSE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:BiaMvSyXj/ErpO2b3KaluJfo6TA=
In-Reply-To: <uesc36$20j2u$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 29 Sep 2023 01:50 UTC

On 9/25/2023 9:21 AM, Bonita Montero wrote:
> Am 25.09.2023 um 17:51 schrieb Scott Lurndal:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>
>
>>> lock() and unlock() might throw system_error.
>
>> lock() and unlock() cannot throw any error.
>
> https://en.cppreference.com/w/cpp/thread/mutex/lock
>
> Ā Ā Ā Ā "Throws std::system_error when errors occur, including errors
> Ā Ā Ā Ā from the underlying operating system that would prevent lock
> Ā Ā Ā Ā from meeting its specifications. The mutex is not locked in
> Ā Ā Ā Ā the case of any exception being thrown."
>
> https://en.cppreference.com/w/cpp/thread/mutex/unlock
>
> Ā Ā Ā Ā "Throws nothing"
>
> You're right only in the latter case.
>

Study up Bonita!!!! Damn it.

Re: Thread-safe initialization of static objects

<uf5gjh$3at7$1@dont-email.me>

  copy mid

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

  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: Thu, 28 Sep 2023 20:34:09 -0700
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uf5gjh$3at7$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> <cd5QM.124661$1B%c.70710@fx09.iad>
<uereqt$1qg8s$2@dont-email.me> <0ZdQM.67168$3vM.59997@fx37.iad>
<uesbeo$20ej3$1@dont-email.me> <JJoQM.19136$EIy4.15229@fx48.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 03:34:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="109479"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+H7HUjURoN1eb5nE2RO1lPhYWeNN34+J0="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:++pUWf0zsQp7X+bco+27nv5oW3Q=
Content-Language: en-US
In-Reply-To: <JJoQM.19136$EIy4.15229@fx48.iad>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 03:34 UTC

On 9/25/2023 4:29 PM, Richard Damon wrote:
> On 9/25/23 12:11 PM, Bonita Montero wrote:
>> Am 25.09.2023 um 13:15 schrieb Richard Damon:
>>
>>> You argument is basically, the Standard needs to allow for BAD
>>> implementation to exist.
>>
>> And implementation that throws in this situation isn't bad for me.
>
> So, you don't mind you code not working as promised.
>
> I guess you don't have to write code that actually works.

The sick joke aspect.... Humm.... ;^o

Re: Thread-safe initialization of static objects

<uf6ecm$8rfg$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 14:02:30 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uf6ecm$8rfg$1@dont-email.me>
References: <udafjf$2joeq$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> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me> <eJCQM.35600$ugs.8334@fx36.iad>
<ueutjo$2ii89$2@dont-email.me> <S%pRM.268878$2ph4.195852@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 12:02:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="290288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+U9XFDoLlGa+jHldhcf4AxVggQFaRPBNw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:m/5ODLqJ+MbXgwg3mkCEsFy/B/E=
In-Reply-To: <S%pRM.268878$2ph4.195852@fx14.iad>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 12:02 UTC

Am 29.09.2023 um 03:46 schrieb Pavel:

> see my or Kaz's explanation for how it is done without allocating any
> kernel resource on either initialization or locking, either fast or slow
> path.

.... on Linux with signals.

Re: Thread-safe initialization of static objects

<uf6edv$8rfg$2@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 14:03:11 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uf6edv$8rfg$2@dont-email.me>
References: <udafjf$2joeq$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> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 12:03:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="290288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OA0R8cUhLemZcY0L63DLCHJ7xLG4YhIk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Fl6FXCoMAnbn1KZYdn/tIbEhmho=
In-Reply-To: <0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 12:03 UTC

Am 28.09.2023 um 23:34 schrieb Michael S:

> My tests use small # of threads (3), but can wait, sequentially, on lots
> of critical sections.

The kernel-resources are only allocated on contention.

Re: Thread-safe initialization of static objects

<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:ad4:55ed:0:b0:655:d0b0:59e7 with SMTP id bu13-20020ad455ed000000b00655d0b059e7mr51314qvb.3.1695989267764;
Fri, 29 Sep 2023 05:07:47 -0700 (PDT)
X-Received: by 2002:a05:6808:1495:b0:3a7:27a:86e3 with SMTP id
e21-20020a056808149500b003a7027a86e3mr1907072oiw.3.1695989267061; Fri, 29 Sep
2023 05:07:47 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Fri, 29 Sep 2023 05:07:46 -0700 (PDT)
In-Reply-To: <uf6edv$8rfg$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:b85f:f9ca:a2bd:dd27;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:b85f:f9ca:a2bd:dd27
References: <udafjf$2joeq$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> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me> <00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com> <uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com> <uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com> <uf6edv$8rfg$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Fri, 29 Sep 2023 12:07:47 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Michael S - Fri, 29 Sep 2023 12:07 UTC

On Friday, September 29, 2023 at 3:03:30ā€ÆPM UTC+3, Bonita Montero wrote:
> Am 28.09.2023 um 23:34 schrieb Michael S:
>
> > My tests use small # of threads (3), but can wait, sequentially, on lots
> > of critical sections.
> The kernel-resources are only allocated on contention.

I care to assure contention.

Re: Thread-safe initialization of static objects

<uf6f5a$8vee$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 14:15:38 +0200
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uf6f5a$8vee$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <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>
<PKZPM.232647$ZXz4.71820@fx18.iad> <ueqfkl$1i6un$2@dont-email.me>
<Fa5QM.124660$1B%c.102962@fx09.iad> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 12:15:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="294350"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/H+Iq1JzBGJ/BIkGWoQKO9lQIK8xRsw7w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wyP8XKwEDHocZ7qsLtNltJqv8XA=
In-Reply-To: <e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 12:15 UTC

Am 29.09.2023 um 14:07 schrieb Michael S:

> I care to assure contention.

Foreach critical section you'd need a blocking thread and one thread
which holds the lock, not only three for thousands of critical sections.

Re: Thread-safe initialization of static objects

<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:620a:688e:b0:76d:9ee4:2b2b with SMTP id rv14-20020a05620a688e00b0076d9ee42b2bmr41829qkn.15.1695991042624;
Fri, 29 Sep 2023 05:37:22 -0700 (PDT)
X-Received: by 2002:a05:6870:b7b1:b0:1dd:3076:9dfd with SMTP id
ed49-20020a056870b7b100b001dd30769dfdmr1553851oab.8.1695991042401; Fri, 29
Sep 2023 05:37:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.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: Fri, 29 Sep 2023 05:37:21 -0700 (PDT)
In-Reply-To: <uf6f5a$8vee$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:b85f:f9ca:a2bd:dd27;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:b85f:f9ca:a2bd:dd27
References: <udafjf$2joeq$1@dont-email.me> <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>
<PKZPM.232647$ZXz4.71820@fx18.iad> <ueqfkl$1i6un$2@dont-email.me>
<Fa5QM.124660$1B%c.102962@fx09.iad> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com> <d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me> <3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me> <0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me> <e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
Subject: Re: Thread-safe initialization of static objects
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Fri, 29 Sep 2023 12:37:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2582
 by: Michael S - Fri, 29 Sep 2023 12:37 UTC

On Friday, September 29, 2023 at 3:15:57ā€ÆPM UTC+3, Bonita Montero wrote:
> Am 29.09.2023 um 14:07 schrieb Michael S:
>
> > I care to assure contention.
> Foreach critical section you'd need a blocking thread and one thread
> which holds the lock, not only three for thousands of critical sections.

You wanted to see code, I showed you code. As expected, you didn't understand.

Re: Thread-safe initialization of static objects

<uf6nbt$al3q$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 16:35:42 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <uf6nbt$al3q$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <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>
<PKZPM.232647$ZXz4.71820@fx18.iad> <ueqfkl$1i6un$2@dont-email.me>
<Fa5QM.124660$1B%c.102962@fx09.iad> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 14:35:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="349306"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8KDey+e0z2Sfqx/VjtYaD22KraAulBRQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:32ZDqSeCvkdOVKDAQ4/V0Mu6bHs=
Content-Language: de-DE
In-Reply-To: <6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
 by: Bonita Montero - Fri, 29 Sep 2023 14:35 UTC

Am 29.09.2023 um 14:37 schrieb Michael S:

> You wanted to see code, I showed you code. As expected, you didn't understand.

To enforce delayed creation you have to contend. And if you contend
you're going to sleep. So the minimum approach would be to have one
thread owning the critical sections and for each critical section a
contending thread. There's no way to enforce delayed creation for a
large number of critical sections with a small number of threads.
And you absolutely don't need to use thread priorities or affinities
here.

Re: Thread-safe initialization of static objects

<861qehggye.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c++
Subject: Re: Thread-safe initialization of static objects
Date: Fri, 29 Sep 2023 08:03:05 -0700
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <861qehggye.fsf@linuxsc.com>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad> <ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad> <uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me> <00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com> <d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com> <uf3npo$3li66$1@dont-email.me> <3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com> <uf3siu$3me1l$1@dont-email.me> <0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com> <uf6edv$8rfg$2@dont-email.me> <e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com> <uf6f5a$8vee$1@dont-email.me> <6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="13636bbb038e3a1f79d11dd50eec8409";
logging-data="358958"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/u7q352ATWDA0To44WNyn29DGZn68f2DY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:ERAVkHXqEJEPoOYOh5pztvJeacM=
sha1:9zaA9WQibgik0Oc3dXzxZ+Mn+jU=
 by: Tim Rentsch - Fri, 29 Sep 2023 15:03 UTC

Michael S <already5chosen@yahoo.com> writes:

> On Friday, September 29, 2023 at 3:15:57?PM UTC+3, Bonita Montero wrote:
>
>> Am 29.09.2023 um 14:07 schrieb Michael S:
>>
>>> I care to assure contention.
>>
>> Foreach critical section you'd need a blocking thread and one
>> thread which holds the lock, not only three for thousands of
>> critical sections.
>
> You wanted to see code, I showed you code. As expected, you didn't
> understand.

To me the real question is why you bother to respond
to Bonita at all, or even read his/her/its postings.
You are obviously a smart guy, I hope you have better
things to do.

Re: Thread-safe initialization of static objects

<uf6p92$b29n$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 17:08:19 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uf6p92$b29n$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 15:08:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="362807"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18R2zQ8CLSlE+MHTNagmgkmTmcXy5xa5Wk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:v0eMZcLrCWXaq6JOvViSkZgRJ3g=
In-Reply-To: <861qehggye.fsf@linuxsc.com>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 15:08 UTC

Am 29.09.2023 um 17:03 schrieb Tim Rentsch:

> To me the real question is why you bother to respond
> to Bonita at all, or even read his/her/its postings.
> You are obviously a smart guy, I hope you have better
> things to do.

Yes, take measurements incorrectly.

Re: Thread-safe initialization of static objects

<uf75ud$de0v$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 11:44:29 -0700
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <uf75ud$de0v$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 18:44:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="440351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tW4tG3oMoUhMaz+E5c5uKTtQVToP/EAg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:HIrn8xYq2sW4jaXzFzmdBo7f+xU=
Content-Language: en-US
In-Reply-To: <861qehggye.fsf@linuxsc.com>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 18:44 UTC

On 9/29/2023 8:03 AM, Tim Rentsch wrote:
> Michael S <already5chosen@yahoo.com> writes:
>
>> On Friday, September 29, 2023 at 3:15:57?PM UTC+3, Bonita Montero wrote:
>>
>>> Am 29.09.2023 um 14:07 schrieb Michael S:
>>>
>>>> I care to assure contention.
>>>
>>> Foreach critical section you'd need a blocking thread and one
>>> thread which holds the lock, not only three for thousands of
>>> critical sections.
>>
>> You wanted to see code, I showed you code. As expected, you didn't
>> understand.
>
> To me the real question is why you bother to respond
> to Bonita at all, or even read his/her/its postings.
> You are obviously a smart guy, I hope you have better
> things to do.

I am trying to urge Michael to give Relacy Race Detector a go, for fun
on his free time. Free time meaning very bored with nothing to do.

https://www.1024cores.net/home/relacy-race-detector

https://github.com/dvyukov/relacy

Re: Thread-safe initialization of static objects

<uf76hu$di35$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 20:54:54 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uf76hu$di35$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 18:54:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="444517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18y1yU9I6qe/xR1XvdzYV2o2Fr5YL91gAE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:afz/yu3u15cdzXBAbvp5dRA8chM=
Content-Language: de-DE
In-Reply-To: <uf75ud$de0v$1@dont-email.me>
 by: Bonita Montero - Fri, 29 Sep 2023 18:54 UTC

Am 29.09.2023 um 20:44 schrieb Chris M. Thomasson:

> I am trying to urge Michael to give Relacy Race Detector a go, for
> fun on his free time. Free time meaning very bored with nothing to do.

You always have objections that have nothing directly to do with
the topic. I think his code is also ugly because it's bare C and
in C++ the code would be one third in size, but I don't feel that
uncertain like you to make such objections.

Re: Thread-safe initialization of static objects

<uf76n8$de0v$2@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 11:57:44 -0700
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uf76n8$de0v$2@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 29 Sep 2023 18:57:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="440351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EY/h1nsp/HwDyKeETz6yRheAG3p+lXSY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:NhCQnzOCctVzd4iW5TxHiZxEAog=
In-Reply-To: <uf76hu$di35$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 29 Sep 2023 18:57 UTC

On 9/29/2023 11:54 AM, Bonita Montero wrote:
> Am 29.09.2023 um 20:44 schrieb Chris M. Thomasson:
>
>> I am trying to urge Michael to give Relacy Race Detector a go, for
>> funĀ  on his free time. Free time meaning very bored with nothing to do.
>
> You always have objections that have nothing directly to do with
> the topic.

How is what I wrote, an objection? Objection to what!?

> I think his code is also ugly because it's bare C and
> in C++ the code would be one third in size, but I don't feel that
> uncertain like you to make such objections.
>

If __you__ think the code is ugly, so be it. Don't project on me, Bonita.

Re: Thread-safe initialization of static objects

<uf76t9$de0v$3@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 12:00:56 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uf76t9$de0v$3@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 29 Sep 2023 19:00:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="440351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188XSXjXJANdmFMvDudtQaM9tTU5QQ7D2E="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:ArbvaEnNvse/fSANi5t40Ed+MG4=
Content-Language: en-US
In-Reply-To: <uf76hu$di35$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 19:00 UTC

On 9/29/2023 11:54 AM, Bonita Montero wrote:
> Am 29.09.2023 um 20:44 schrieb Chris M. Thomasson:
>
>> I am trying to urge Michael to give Relacy Race Detector a go, for
>> funĀ  on his free time. Free time meaning very bored with nothing to do.
>
> You always have objections that have nothing directly to do with
> the topic. I think his code is also ugly because it's bare C and
> in C++ the code would be one third in size, but I don't feel that
> uncertain like you to make such objections.
>

Bonita, you have a lot to learn about synchronization algorithms... I
have read what you wrote, and well, you would be fired from the team. I
have tried to help you, but you always try to shut me down. So be it.
Fine with me. I am starting to wonder why I am casting pearls before
swine, so to speak... ;^o

Re: Thread-safe initialization of static objects

<uf77d7$dnjd$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 21:09:27 +0200
Organization: A noiseless patient Spider
Lines: 925
Message-ID: <uf77d7$dnjd$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:09:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="450157"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+K6q83MtU2ZHmCIpt74iSIOJcMQjN/A9s="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:T58c7uamAdxkkMmxX2p2hyC1b1s=
Content-Language: de-DE
In-Reply-To: <uf76t9$de0v$3@dont-email.me>
 by: Bonita Montero - Fri, 29 Sep 2023 19:09 UTC

Am 29.09.2023 um 21:00 schrieb Chris M. Thomasson:

> Bonita, you have a lot to learn about synchronization algorithms... I

Write sth. like that:

// header:

#pragma once
#include <cstdint>
#include <cassert>
#include <thread>
#include <new>
#include <atomic>
#include <stdexcept>
#include <exception>
#include <limits>
#include <cstdint>
#include <semaphore>
#include <string>
#include <optional>
#include "thread_id.h"
#include "msvc-disabler.h"

#if defined(__llvm__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdangling-else"
#endif

struct wbias_shared_mutex;

struct wbsm_exception : public std::exception
{ enum reason
{
SHARER_COUNTER_SATURATED = 1,
WATING_EXCLUSIVE_COUNTER_SATURATED = 2,
RECURSION_COUNTER_SATURATED = 3
};
wbsm_exception() = delete;
wbsm_exception( wbsm_exception const & ) = default;
reason get_reason();
virtual char const *what() const noexcept;
private:
friend struct wbias_shared_mutex;
wbsm_exception( reason r, char const *what );
reason m_reason;
std::string m_what;
};

inline wbsm_exception::wbsm_exception( reason r, char const *what ) :
m_reason( r ),
m_what( what )
{ }

inline wbsm_exception::reason wbsm_exception::get_reason()
{ return m_reason;
}

static_assert(std::atomic<uint64_t>::is_always_lock_free, "uint64_t must
be lock-free");

struct
#if defined(__cpp_lib_hardware_interference_size)
alignas(std::hardware_destructive_interference_size)
#else
alignas(64)
#endif
wbias_shared_mutex
{ wbias_shared_mutex( int16_t maxExclusiveSpinCount = 0, int16_t
maxSharedSpinCount = 0 );
wbias_shared_mutex( wbias_shared_mutex const & ) = delete;
void operator =( wbias_shared_mutex const & ) = delete;
~wbias_shared_mutex();
void lock_shared( bool force = false );
bool try_lock_shared( bool force = false );
void unlock_shared();
void shared_to_exclusive( thread_id threadId = thread_self() );
void lock_exclusive( thread_id threadId = thread_self() );
bool try_lock_exclusive( thread_id threadId = thread_self() );
bool lock_preferred_shared( bool force = false, thread_id threadId =
thread_self() );
void unlock_exclusive( thread_id threadId = thread_self() );
void exclusive_to_shared( bool force = false );
bool is_shared();
bool is_exclusive();
bool we_are_exclusive( thread_id threadId = thread_self() );
thread_id get_exclusive_thread_id();
uint32_t get_exclusive_recursion_count();
int16_t max_exclusive_spin_count( int16_t max = 100 );
int16_t max_shared_spin_count( int16_t max = 100 );
private:
static_assert(std::atomic<uint64_t>::is_always_lock_free,
"std::atomic<uint64_t> must be always lock-free");
std::atomic<uint64_t> m_atomic;
std::atomic<thread_id> m_exclusiveId;
std::atomic_uint32_t m_exclusiveRecursionCount;
std::atomic_int16_t m_exclusiveSpinCount, m_sharedSpinCount; //
adaptive spinning taken from glibc
std::atomic_int16_t m_maxExclusiveSpinCount, m_maxSharedSpinCount;
std::counting_semaphore<(1 << 21) - 1> m_releaseSharedSem;
std::binary_semaphore m_releaseExclusiveSem;
static unsigned const
WAITING_SHARERS_BASE = 21,
WAITING_EXCLUSIVE_BASE = 2 * 21,
EXCLUSIVE_FLAG_BASE = 3 * 21;
static constexpr uint64_t
MASK21 = 0x1FFFFFu,
SHARERS_MASK = MASK21,
WAITING_SHARERS_MASK = MASK21 << WAITING_SHARERS_BASE,
WAITING_EXCLUSIVE_MASK = MASK21 << WAITING_EXCLUSIVE_BASE,
EXCLUSIVE_FLAG_MASK = (uint64_t)1 << EXCLUSIVE_FLAG_BASE,
SHARER_VALUE = (uint64_t)1,
WAITING_SHARERS_VALUE = (uint64_t)1 << WAITING_SHARERS_BASE,
WAITING_EXCLUSIVE_VALUE = (uint64_t)1 << WAITING_EXCLUSIVE_BASE;
static constexpr short DEFAULT_MAX_SPIN_COUNT = 100;
#if !defined(NDEBUG)
static bool check( uint64_t flags );
#endif
bool internalSpinLockShared( uint64_t &cmp, bool force );
void internalLockShared( uint64_t cmp, bool force );
bool internalSpinLockExclusive( uint64_t &cmp, thread_id threadId );
void cpuPause();
};

inline bool wbias_shared_mutex::is_shared()
{ return m_atomic.load( std::memory_order_relaxed ) & SHARERS_MASK;
}

inline bool wbias_shared_mutex::is_exclusive()
{ return m_atomic.load( std::memory_order_relaxed ) & EXCLUSIVE_FLAG_MASK;
}

inline bool wbias_shared_mutex::we_are_exclusive( thread_id threadId )
{ return (m_atomic.load( std::memory_order_relaxed ) & EXCLUSIVE_FLAG_MASK)
&& m_exclusiveId.load( std::memory_order_relaxed ) == threadId;
}

inline thread_id wbias_shared_mutex::get_exclusive_thread_id()
{ //std::atomic_thread_fence( std::memory_order_acquire );
return m_exclusiveId.load( std::memory_order_relaxed );
}

inline uint32_t wbias_shared_mutex::get_exclusive_recursion_count()
{ return m_exclusiveRecursionCount.load( std::memory_order_relaxed );
}

struct wbsm_lock
{ enum
{
UNLOCKED,
SHARED,
EXLUSIVE
};
wbsm_lock();
wbsm_lock( wbsm_lock const &other );
wbsm_lock( wbsm_lock &&other ) noexcept;
wbsm_lock( wbias_shared_mutex &mtx, bool lockShared = true, thread_id
threadId = thread_self() );
~wbsm_lock();
wbsm_lock &operator =( wbsm_lock const &other );
wbsm_lock &operator =( wbsm_lock &&other ) noexcept;
void lock_shared( wbias_shared_mutex &mtx );
void shared_to_exclusive( thread_id threadId = thread_self() );
void exclusive_to_shared( bool force = false );
void lock_exclusive( wbias_shared_mutex &mtx, thread_id threadId =
thread_self() );
void unlock();
void lock_preferred_shared( wbias_shared_mutex &mtx, thread_id threadId
= thread_self() );
bool is_locked() const;
bool is_shared() const;
bool is_exclusive() const;
thread_id get_exclusive_thread_id() const;
wbias_shared_mutex *get_mutex() const;
std::pair<int, wbias_shared_mutex *> get_state() const;
void set_state( int state, wbias_shared_mutex *pMtx );
private:
wbias_shared_mutex *m_mtx;
bool m_isShared;
thread_id m_threadId;
};

inline wbsm_lock::wbsm_lock()
{ m_mtx = nullptr;
}

inline wbsm_lock::wbsm_lock( wbsm_lock &&other ) noexcept :
m_mtx( other.m_mtx ),
m_isShared( other.m_isShared ),
m_threadId( other.m_threadId )
{ other.m_mtx = nullptr;
#if !defined(NDEBUG)
other.m_threadId = 0;
#endif
}

inline bool wbsm_lock::is_locked() const
{ return m_mtx != nullptr;
}

inline bool wbsm_lock::is_shared() const
{ assert(m_mtx);
return m_isShared;
}

inline bool wbsm_lock::is_exclusive() const
{ assert(m_mtx);
return !m_isShared;
}

inline thread_id wbsm_lock::get_exclusive_thread_id() const
{ return m_threadId;
}

inline wbias_shared_mutex *wbsm_lock::get_mutex() const
{ return m_mtx;
}

#if defined(__llvm__)
#pragma clang diagnostic pop
#endif

// source:

#include <utility>
#include "wbias_shared_mutex.h"
#include "xassert.h"
#include "exc_encapsulate.h"
#if defined(_MSC_VER)
#include <intrin.h>
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
#include <immintrin.h>
#endif
#if defined(__llvm__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdangling-else"
#endif

char const *wbsm_exception::what() const noexcept
{ return m_what.c_str();
}

#if !defined(NDEBUG)
inline bool wbias_shared_mutex::check( std::uint64_t flags )
{ unsigned
sharers = (unsigned)(flags & MASK21),
waitingExclusive = (unsigned)((flags >> WAITING_EXCLUSIVE_BASE) & MASK21),
exclusiveFlag = (unsigned)((flags >> EXCLUSIVE_FLAG_BASE) & 1);
if( sharers && exclusiveFlag )
return false;
if( waitingExclusive && !exclusiveFlag && !sharers )
return false;
return true;
} #endif

wbias_shared_mutex::wbias_shared_mutex( int16_t maxExclusiveSpinCount,
int16_t maxSharedSpinCount ) :
m_atomic( 0 ),
m_exclusiveId(),
m_exclusiveSpinCount( 0 ),
m_sharedSpinCount( 0 ),
m_maxExclusiveSpinCount( maxExclusiveSpinCount ),
m_maxSharedSpinCount( maxSharedSpinCount ),
m_releaseSharedSem( 0 ),
m_releaseExclusiveSem( false )
{ }

wbias_shared_mutex::~wbias_shared_mutex()
{ assert(!m_atomic);
}

// throws wbsm_exception if waiting sharers counter saturates

void wbias_shared_mutex::lock_shared( bool force )
{ using namespace std;
uint64_t cmp = m_atomic.load( memory_order_relaxed );
if( internalSpinLockShared( cmp, force ) )
return;
internalLockShared( cmp, force );
}

inline bool wbias_shared_mutex::internalSpinLockShared( std::uint64_t
&cmp, bool force )
{ using namespace std;
int16_t maxSharedSpinCount = m_maxSharedSpinCount.load(
memory_order_relaxed );
if( maxSharedSpinCount <= 0 )
return false;
int16_t sharedSpinCount = m_sharedSpinCount.load( memory_order_relaxed );
int32_t spinLimit = (int32_t)sharedSpinCount * 2 + 10;
spinLimit = spinLimit <= maxSharedSpinCount ? spinLimit :
maxSharedSpinCount;
int32_t spinCount = 0;
bool locked = false;
for( ; ; )
{
assert(check( cmp ));
if( !(cmp & (EXCLUSIVE_FLAG_MASK | (!force ? WAITING_EXCLUSIVE_MASK :
0))) )
if( (cmp & SHARERS_MASK) == SHARERS_MASK )
break;
else if( m_atomic.compare_exchange_weak( cmp, cmp + SHARER_VALUE,
memory_order_acquire, memory_order_relaxed ) )
{
locked = true;
break;
}
if( ++spinCount >= spinLimit )
break;
cpuPause();
cmp = m_atomic.load( memory_order_relaxed );
}
m_sharedSpinCount.store( sharedSpinCount + ((int16_t)spinCount -
sharedSpinCount) / 8, memory_order_relaxed );
return locked;
}


Click here to read the complete article
Re: Thread-safe initialization of static objects

<uf78do$dsh0$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 12:26:47 -0700
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uf78do$dsh0$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <PKZPM.232647$ZXz4.71820@fx18.iad>
<ueqfkl$1i6un$2@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:26:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="455200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CNm7oeyfiXXbTvVbF4YxzIod6GVAm3UU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:BXuDcBBFI0DodnKsYYso1Frk0OQ=
Content-Language: en-US
In-Reply-To: <uf77d7$dnjd$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 19:26 UTC

On 9/29/2023 12:09 PM, Bonita Montero wrote:
> Am 29.09.2023 um 21:00 schrieb Chris M. Thomasson:
>
>> Bonita, you have a lot to learn about synchronization algorithms... I
>
> Write sth. like that:
[...]

Run it through a race detector, make sure it works.

Re: Thread-safe initialization of static objects

<uf78fo$dsh0$2@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 12:27:51 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <uf78fo$dsh0$2@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <ueqfkl$1i6un$2@dont-email.me>
<Fa5QM.124660$1B%c.102962@fx09.iad> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:27:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="455200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/F58SYb+1Iu4tgbn9QJ3pagfcobWVx87I="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:832IIT196V+90roFvmiodVa3vg0=
Content-Language: en-US
In-Reply-To: <uf78do$dsh0$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 19:27 UTC

On 9/29/2023 12:26 PM, Chris M. Thomasson wrote:
> On 9/29/2023 12:09 PM, Bonita Montero wrote:
>> Am 29.09.2023 um 21:00 schrieb Chris M. Thomasson:
>>
>>> Bonita, you have a lot to learn about synchronization algorithms... I
>>
>> Write sth. like that:
> [...]
>
> Run it through a race detector, make sure it works.
>

It's good to do that. Why are you so against using a race detector?

Re: Thread-safe initialization of static objects

<uf78l4$dujs$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 21:30:44 +0200
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uf78l4$dujs$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <ueqfkl$1i6un$2@dont-email.me>
<Fa5QM.124660$1B%c.102962@fx09.iad> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:30:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="457340"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GsCafbtcHn34NDePubxOv/7CVCr7+zxg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:HZapT3ggAdGbN5JgUqHVmWfdx5M=
In-Reply-To: <uf78do$dsh0$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 19:30 UTC

Am 29.09.2023 um 21:26 schrieb Chris M. Thomasson:

> Run it through a race detector, make sure it works.

Your only answer to any MT-code that overburdens you is:
use a race detector.

Re: Thread-safe initialization of static objects

<uf78n7$dujs$2@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 21:31:51 +0200
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uf78n7$dujs$2@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
<uf78fo$dsh0$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:31:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="457340"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bSSTS8fCH22Fa/BsjDgdHZp4XupKeTek="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:g7/kjO730wmu9ctafh+7kfKb6Hc=
In-Reply-To: <uf78fo$dsh0$2@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 19:31 UTC

Am 29.09.2023 um 21:27 schrieb Chris M. Thomasson:

> It's good to do that. Why are you so against using a race detector?

MT-primitives are hard to debug, so they need
to be designed with a clearer mind than yours.

Re: Thread-safe initialization of static objects

<uf78rd$dsh0$4@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 12:34:05 -0700
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <uf78rd$dsh0$4@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
<uf78fo$dsh0$2@dont-email.me> <uf78n7$dujs$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:34:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="455200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FwH7tr0SitkgDKopEEze2kGxc+2H0JD8="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:t/ext5bxviTRuGUaTTJxzEuzTXE=
Content-Language: en-US
In-Reply-To: <uf78n7$dujs$2@dont-email.me>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 19:34 UTC

On 9/29/2023 12:31 PM, Bonita Montero wrote:
> Am 29.09.2023 um 21:27 schrieb Chris M. Thomasson:
>
>> It's good to do that. Why are you so against using a race detector?
>
> MT-primitives are hard to debug, so they need
> to be designed with a clearer mind than yours.
>

Huh? Run your code through a race detector and we can go from there. You
want me to try to find a bug in the code you posted? Well, pay me.

Re: Thread-safe initialization of static objects

<uf7902$dsh0$5@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 12:36:34 -0700
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uf7902$dsh0$5@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <Fa5QM.124660$1B%c.102962@fx09.iad>
<uerem0$1qg8s$1@dont-email.me> <ZYdQM.67167$3vM.17655@fx37.iad>
<uerv9b$1tqis$1@dont-email.me> <LJoQM.19137$EIy4.5875@fx48.iad>
<uetn46$2bkun$1@dont-email.me> <3bzQM.36476$q0k.14387@fx34.iad>
<ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
<uf78l4$dujs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:36:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="455200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XdAY8y2+WX2tnzWdOVE8N4XdpF8RfyH4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:iHPa1nKyjCT5kqJ7UHi6qe9hBEI=
In-Reply-To: <uf78l4$dujs$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 29 Sep 2023 19:36 UTC

On 9/29/2023 12:30 PM, Bonita Montero wrote:
> Am 29.09.2023 um 21:26 schrieb Chris M. Thomasson:
>
>> Run it through a race detector, make sure it works.
>
> Your only answer to any MT-code that overburdens you is:
> use a race detector.
>

Huh? Lets make sure it passes some tests, then we can dig into it. There
could be a false negative. I don't think you like to test any of your
own code. Just throwing some example runs at it is not enough.

Re: Thread-safe initialization of static objects

<uf791g$e0t3$1@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 21:37:20 +0200
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <uf791g$e0t3$1@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
<uf78fo$dsh0$2@dont-email.me> <uf78n7$dujs$2@dont-email.me>
<uf78rd$dsh0$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:37:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d258e34836ce4d1fad690ea3ecd020af";
logging-data="459683"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+m8EsdUSm9WyDxXYJH3toKiy5eL48XnIQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:fHP/06frl9vLPwH7e31o0I+Jn2w=
In-Reply-To: <uf78rd$dsh0$4@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Fri, 29 Sep 2023 19:37 UTC

Am 29.09.2023 um 21:34 schrieb Chris M. Thomasson:

> Huh? Run your code through a race detector and we can go from there.
> You want me to try to find a bug in the code you posted? Well, pay me.

Idiot !

Re: Thread-safe initialization of static objects

<uf793c$dsh0$6@dont-email.me>

  copy mid

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

  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: Fri, 29 Sep 2023 12:38:20 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uf793c$dsh0$6@dont-email.me>
References: <udafjf$2joeq$1@dont-email.me> <uerem0$1qg8s$1@dont-email.me>
<ZYdQM.67167$3vM.17655@fx37.iad> <uerv9b$1tqis$1@dont-email.me>
<LJoQM.19137$EIy4.5875@fx48.iad> <uetn46$2bkun$1@dont-email.me>
<3bzQM.36476$q0k.14387@fx34.iad> <ueuj9u$2gdqk$3@dont-email.me>
<00d0c42f-7728-4a7b-9611-3f24f98735ffn@googlegroups.com>
<d1fc9003-673c-4d7b-ad17-d37a75c39bd3n@googlegroups.com>
<uf3npo$3li66$1@dont-email.me>
<3d9a2d52-5a7d-4a6f-b4a6-1aa98feba2e7n@googlegroups.com>
<uf3siu$3me1l$1@dont-email.me>
<0362fb54-0227-4cd2-8676-419a34c8fdb4n@googlegroups.com>
<uf6edv$8rfg$2@dont-email.me>
<e3c26612-d4dd-4428-8e56-17ce08a4da21n@googlegroups.com>
<uf6f5a$8vee$1@dont-email.me>
<6ba8ab42-f622-4c48-973e-8800f3f44a66n@googlegroups.com>
<861qehggye.fsf@linuxsc.com> <uf75ud$de0v$1@dont-email.me>
<uf76hu$di35$1@dont-email.me> <uf76t9$de0v$3@dont-email.me>
<uf77d7$dnjd$1@dont-email.me> <uf78do$dsh0$1@dont-email.me>
<uf78l4$dujs$1@dont-email.me> <uf7902$dsh0$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 29 Sep 2023 19:38:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="20313435b82470e1f6eec4f85dde8931";
logging-data="455200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5VOVTjoKmSR7T4A2rBLbmjcHu7hO5cVA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:VtrygAIZMoLe/lJgnKIxfihG/F0=
Content-Language: en-US
In-Reply-To: <uf7902$dsh0$5@dont-email.me>
 by: Chris M. Thomasson - Fri, 29 Sep 2023 19:38 UTC

On 9/29/2023 12:36 PM, Chris M. Thomasson wrote:
> On 9/29/2023 12:30 PM, Bonita Montero wrote:
>> Am 29.09.2023 um 21:26 schrieb Chris M. Thomasson:
>>
>>> Run it through a race detector, make sure it works.
>>
>> Your only answer to any MT-code that overburdens you is:
>> use a race detector.
>>
>
> Huh? Lets make sure it passes some tests, then we can dig into it. There
> could be a false negative. I don't think you like to test any of your
> own code. Just throwing some example runs at it is not enough.

Say, a race detector finds a race condition in your code. You examine it
and can _prove_ that it works, well, then the race detector was wrong.
We can now dive into it.


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

Pages:123456789101112131415161718192021222324252627
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor