public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix pthread_cond_wait bug on !i386 !x86_64
Date: Mon, 24 May 2004 11:27:00 -0000	[thread overview]
Message-ID: <20040521132238.GM5191@sunsite.ms.mff.cuni.cz> (raw)

Hi!

I hope this is the only cause of the random failures of tst-cond{16,17,18}
on pthread_cond_*.c using architectures.
Certainly on 7way PPC I managed to run 71 tst-cond18 runs without a failure
(while previously it took at most 20 to fail) and so far 16 tst-cond16 runs.

2004-05-21  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/pthread/pthread_cond_wait.c (__pthread_cond_wait): Compare
	__broadcast_seq with bc_seq after acquiring internal lock instead of
	before it.

--- libc/nptl/sysdeps/pthread/pthread_cond_wait.c.jj	2004-05-19 22:58:46.000000000 +0200
+++ libc/nptl/sysdeps/pthread/pthread_cond_wait.c	2004-05-21 17:30:54.654099109 +0200
@@ -143,13 +143,13 @@ __pthread_cond_wait (cond, mutex)
       /* Disable asynchronous cancellation.  */
       __pthread_disable_asynccancel (cbuffer.oldtype);
 
+      /* We are going to look at shared data again, so get the lock.  */
+      lll_mutex_lock (cond->__data.__lock);
+
       /* If a broadcast happened, we are done.  */
       if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
 	goto bc_out;
 
-      /* We are going to look at shared data again, so get the lock.  */
-      lll_mutex_lock (cond->__data.__lock);
-
       /* Check whether we are eligible for wakeup.  */
       val = cond->__data.__wakeup_seq;
     }

	Jakub

                 reply	other threads:[~2004-05-21 20:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040521132238.GM5191@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@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).