public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Gottlob Frege <gottlobfrege@gmail.com>
To: Alexander Terekhov <TEREKHOV@de.ibm.com>
Cc: Pthreads-Win32 list <pthreads-win32@sources.redhat.com>
Subject: Re: starvation in pthread_once?
Date: Tue, 08 Mar 2005 18:28:00 -0000	[thread overview]
Message-ID: <97ffb3105030810275ac6f5c@mail.gmail.com> (raw)
In-Reply-To: <OF0E4CAEF7.E8B901B9-ONC1256FBE.005E3B7C-C1256FBE.005E9721@de.ibm.com>

On Tue, 8 Mar 2005 18:14:22 +0100, Alexander Terekhov
<TEREKHOV@de.ibm.com> wrote:
> 
> > It would just seem like overkill if all my mutexes needed a
> > mutex to init themselves.
> 
> With CAS (InterlockedCompareExchange), you can use lockless
> DCCI (not DCSI) on slow path to initialize event handle/ptr.
> 
> http://www.google.de/groups?selm=421F44B2.F931491D%40web.de
> 
> regards,
> alexander.
> 

Yes, I remember that conversion.  I've improved my stuff because of it
no doubt.  But in those examples, the slow path was still taken by the
first thread (IIRC - it was because your lock starts out == 0 ie
contention.)  Whereas my version (above, in this thread) avoids the
event creation entirely if there is no contention while initting (ie
first one in does the init, but doesn't create event - only triggers the event
if it finds one there when initting is done).

I'd like to hear your opinion - yours in particular, actually (or
wrath - particularly wrath if necessary.  If there is a problem I need
someone to tell me - threading code is not reliable because of
testing, but because of peer review).

  reply	other threads:[~2005-03-08 18:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-03  9:32 Gottlob Frege
2005-03-04 23:18 ` Ross Johnson
2005-03-08  2:22   ` Ross Johnson
2005-03-08  3:00     ` Gottlob Frege
2005-03-08  6:11       ` Ross Johnson
2005-03-08  9:49         ` Alexander Terekhov
2005-03-08  9:56           ` Alexander Terekhov
2005-03-08  9:58             ` Alexander Terekhov
2005-03-08 16:11               ` Gottlob Frege
2005-03-08 17:14                 ` Alexander Terekhov
2005-03-08 18:28                   ` Gottlob Frege [this message]
2005-03-14  2:47                 ` Ross Johnson
     [not found]                   ` <97ffb310503140832401faa2b@mail.gmail.com>
     [not found]                     ` <1110842168.21321.78.camel@desk.home>
     [not found]                       ` <97ffb3105031415473a3ee169@mail.gmail.com>
     [not found]                         ` <1110855601.21321.203.camel@desk.home>
     [not found]                           ` <97ffb31050321080747aa5a7c@mail.gmail.com>
     [not found]                             ` <1111464847.8363.91.camel@desk.home>
     [not found]                               ` <97ffb3105032209269b0f44e@mail.gmail.com>
2009-09-16 15:38                                 ` Gottlob Frege
2009-09-17  1:28                                   ` Ross Johnson
2005-03-08 16:05       ` Gottlob Frege

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97ffb3105030810275ac6f5c@mail.gmail.com \
    --to=gottlobfrege@gmail.com \
    --cc=TEREKHOV@de.ibm.com \
    --cc=pthreads-win32@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).