public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "martin at lispworks dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug nptl/12875] pthread_cond_timedwait can steal the wakeup of slower thread in pthread_cond_wait
Date: Thu, 20 Sep 2012 14:02:00 -0000	[thread overview]
Message-ID: <bug-12875-131-YHn6z0FDtm@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12875-131@http.sourceware.org/bugzilla/>


http://sourceware.org/bugzilla/show_bug.cgi?id=12875

martin at lispworks dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5787|0                           |1
        is obsolete|                            |

--- Comment #15 from martin at lispworks dot com 2012-09-20 14:01:28 UTC ---
Created attachment 6639
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6639
Test case with explicit happens-before logic rather than usleep

As requested, I've attached a version of the test case that uses the lock,
barriers and atomic instructions to enforce happens-before.  There are 2
remaining calls to usleep, which are needed to ensure ordering between the
calling thread and the internals of pthread_cond_wait than can't be controlled.

This bug may be different from Bug 13165, because it is caused by waking from a
timeout rather than an extra signal.

Why I think this is a bug: my reading of the sentence "The
pthread_cond_signal() function shall unblock at least one of the threads that
are blocked on the specified condition variable cond (if any threads are
blocked on cond)." is that it only affects threads that "are blocked" at the
time pthread_cond_signal() is called, not those that call pthread_cond_wait
afterwards.  The wording for pthread_cond_broadcast() says "currently blocked",
but is that an intentional difference?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2012-09-20 14:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10 17:57 [Bug nptl/12875] New: " martin at lispworks dot com
2011-06-11 13:36 ` [Bug nptl/12875] " drepper.fsp at gmail dot com
2011-06-13 12:39 ` martin at lispworks dot com
2011-09-28 21:55 ` bugdal at aerifal dot cx
2012-03-17 20:41 ` bugdal at aerifal dot cx
2012-04-29  3:01 ` bugdal at aerifal dot cx
2012-09-18 14:18 ` triegel at redhat dot com
2012-09-18 14:28 ` triegel at redhat dot com
2012-09-19  3:21 ` bugdal at aerifal dot cx
2012-09-19  6:24 ` jakub at redhat dot com
2012-09-19  8:22 ` triegel at redhat dot com
2012-09-19  8:24 ` bugdal at aerifal dot cx
2012-09-19  8:50 ` bugdal at aerifal dot cx
2012-09-19 15:35 ` triegel at redhat dot com
2012-09-19 17:30 ` bugdal at aerifal dot cx
2012-09-20 12:29 ` triegel at redhat dot com
2012-09-20 14:02 ` martin at lispworks dot com [this message]
2012-09-20 16:59 ` triegel at redhat dot com
2012-09-21  8:05 ` siddhesh at redhat dot com
2014-06-24  8:36 ` fweimer at redhat dot com

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=bug-12875-131-YHn6z0FDtm@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).