From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25422 invoked by alias); 8 Mar 2005 16:11:23 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 25288 invoked from network); 8 Mar 2005 16:11:13 -0000 Received: from unknown (HELO wproxy.gmail.com) (64.233.184.206) by sourceware.org with SMTP; 8 Mar 2005 16:11:13 -0000 Received: by wproxy.gmail.com with SMTP id 71so1661017wri for ; Tue, 08 Mar 2005 08:11:13 -0800 (PST) Received: by 10.54.13.36 with SMTP id 36mr32834wrm; Tue, 08 Mar 2005 08:11:12 -0800 (PST) Received: by 10.54.7.8 with HTTP; Tue, 8 Mar 2005 08:11:12 -0800 (PST) Message-ID: <97ffb31050308081116245b75@mail.gmail.com> Date: Tue, 08 Mar 2005 16:11:00 -0000 From: Gottlob Frege Reply-To: Gottlob Frege To: Pthreads-Win32 list Subject: Re: starvation in pthread_once? In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-SW-Source: 2005/txt/msg00038.txt.bz2 Do you think it is worth avoiding the named_mutex in favor of a event only created on contention (my version)? (I do, obviously). I'm guessing that for typical usage, contention will be low. And, in my own code, I'm considering making statically initialized mutexes (or CSes) by using a call_once in their constructor. It would just seem like overkill if all my mutexes needed a mutex to init themselves. On Tue, 8 Mar 2005 10:58:23 +0100, Alexander Terekhov wrote: > > Grrr. Bad day. > > if (!once_control) { > named_mutex::guard guard(&once_control2); > if (!once_control2) { > > once_control2 = true; > } > once_control = true; > } > > regards, > alexander. > > Alexander Terekhov/Germany/IBM@IBMDE@sources.redhat.com on 03/08/2005 > 10:55:53 AM > > Sent by: pthreads-win32-owner@sources.redhat.com > > To: Ross Johnson > cc: Pthreads-Win32 list > Subject: Re: starvation in pthread_once? > > > > DCSI-TLS: (__declspec(thread) for control variable; DLL issues > > aside for a moment) > > > > if (!once_control) { > > named_mutex::guard guard(&once_control); > > if (!once_control) { > > > > once_control = true; > > } > > } > > Sorry, I meant: > > if (!once_control) { > named_mutex::guard guard(&once_control); > if (!once_control2) { > > once_control2 = true; > } > once_control = true; > } > > where once_control2 is a non-TLS flag. > > regards, > alexander. > >