Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Alexander Terekhov Newsgroups: comp.std.c,comp.programming.threads,comp.unix.programmer Subject: Re: The threading specs in the standard: a new catastrophe Date: Mon, 11 Jul 2011 13:38:33 +0200 Organization: A noiseless patient Spider Lines: 42 Message-ID: <4E1AE0B9.E522A035@web.de> References: <4e53ba11-fea9-4896-8bb9-6b45acb6e18f@y24g2000yqb.googlegroups.com> <3de2d9ab-e52a-4eb3-a726-b5bed4ce7eef@q1g2000vbj.googlegroups.com> <4E184289.9D95CABB@web.de> Reply-To: terekhov@web.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="MCbSEzW5qwGLFMNXJh39IQ"; logging-data="4104"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yxQZFe++rN1yJYUslfhJs6uYPcsgY874=" X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en Cancel-Lock: sha1:MVz44ooNUee+PTwc0/2bei6uyB0= Xref: x330-a1.tempe.blueboxinc.net comp.std.c:709 comp.programming.threads:419 comp.unix.programmer:933 "Chris M. Thomasson" wrote: > > "Alexander Terekhov" wrote in message > news:4E184289.9D95CABB@web.de... > [...] > > > named_windows_mutex_trick guard(this); > > IIRC, that trick uses something like this to generate a name for the mutex: > _____________________________________________________ > std::string > win_static_init_generate_name( > void const* ptr > ){ > DWORD pid = GetCurrentProcessId(); > DWORD_PTR oid = (DWORD_PTR)ptr; > > std::stringstream name_buf; > name_buf << "SINIT_" << pid << "_" << oid; > > return name_buf.str(); > } > _____________________________________________________ > > Right? Right. http://lists.boost.org/Archives/boost/att-92840/once_mutex.hpp std::string create_unique_name(void* p,const char* tag) { std::ostringstream res; res<<"unique-"<