Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" Newsgroups: comp.lang.c++ Subject: Re: Pre-main construction order in modules Date: Sun, 30 Mar 2025 13:57:47 -0700 Organization: A noiseless patient Spider Lines: 16 Message-ID: References: <48eGP.730204$J61.500281@fx08.ams4> <5HfGP.241316$i41.190620@fx06.ams4> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 30 Mar 2025 22:57:48 +0200 (CEST) Injection-Info: dont-email.me; posting-host="fb31161437cb09e11ca695b7d5812c51"; logging-data="2491118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JrBs7MR+rxvuFjVo5uUfxRN93/SA+ARY=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:em4v4nZK6h7/ZNurEhNtwdwmoag= In-Reply-To: Content-Language: en-US Bytes: 2337 On 3/30/2025 1:15 PM, Bonita Montero wrote: > Am 30.03.2025 um 20:20 schrieb Mr Flibble: > >> But that is nevertheless what the Meyers Singleton involves.  Static >> local >> initialisation has been threadsafe since C++11 and if performance is a >> concern then you can always cache the result in a reference downstream in >> any hot path that needs it. > > With current implemention all C++ runtimes govern all station  initia- > lizations through a single mutex. That hurts if you have a constructor > that takes longer, maybe because of a socket-connection which the code > waits for. > Creating threads, socket-connections before main is a bad idea...? ;^o