public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jmbnyc at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug nptl/16657] Lock elision breaks pthread_mutex_destroy Date: Wed, 02 Jul 2014 17:19:00 -0000 [thread overview] Message-ID: <bug-16657-131-5czGH5cAIy@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-16657-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=16657 --- Comment #20 from Jeffrey M. Birnbaum <jmbnyc at gmail dot com> --- Let me elaborate as to what I see and you can perhaps help me determine if it is the same (or similar) issue reported here. If not, then I will submit a separate bug report (TIA). here is the an outline of the code being used: // assume that construction result in pthread_mutex_trylock where an // internal isLocked variable is set to true if the the call returns 0. mutex_lock::try_lock_guard guard(_db_lock); if (!guard.isLocked()) { // assume timer is returning elapsed time in seconds while(!guard.isLocked() && timer.elapsedTime() < 1.0) { millisleep(1); guard.lock(); // will call try_lock and set locked flag inside guard } } When I run this code compiled with gcc 4.8.2 on my Linux 3.12.8 system (with Haswell processor) I observe that if try_lock fails to get the lock then it never succeeds to to get the lock. And I know (from tracing) that the lock has been released during the time that this code is executing (and that other thread that does release does not attempt to get the lock more than once a second). At first I thought this might be a compiler bug where isLocked() is not being reevaluated each time in the loop but then I came across this report which makes me suspect it is an elision bug not a compiler bug. If it were a compiler bug then I would be quite unnerved and would stop using gcc 4.8.2. Does this help? -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2014-07-02 17:19 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-03-04 9:07 [Bug nptl/16657] New: Lock elision breaks pthread_mutex_trylock schwab@linux-m68k.org 2014-03-04 12:03 ` [Bug nptl/16657] " schwab@linux-m68k.org 2014-03-04 17:51 ` bugdal at aerifal dot cx 2014-03-05 0:32 ` andi-bz at firstfloor dot org 2014-03-05 1:12 ` bugdal at aerifal dot cx 2014-03-05 8:51 ` schwab@linux-m68k.org 2014-03-05 14:14 ` matz at suse dot de 2014-03-05 14:18 ` [Bug nptl/16657] Lock elision breaks pthread_mutex_detroy schwab@linux-m68k.org 2014-03-05 17:57 ` bugdal at aerifal dot cx 2014-03-06 16:03 ` carlos at redhat dot com 2014-03-10 14:14 ` triegel at redhat dot com 2014-03-18 15:31 ` snyder at bnl dot gov 2014-04-04 22:31 ` andi-bz at firstfloor dot org 2014-04-07 9:28 ` schwab@linux-m68k.org 2014-05-28 12:09 ` cvs-commit at gcc dot gnu.org 2014-06-02 14:25 ` pspacek at redhat dot com 2014-06-13 6:39 ` [Bug nptl/16657] Lock elision breaks pthread_mutex_destroy fweimer at redhat dot com 2014-06-16 16:41 ` fweimer at redhat dot com 2014-06-16 16:49 ` bugdal at aerifal dot cx 2014-06-16 16:55 ` fweimer at redhat dot com 2014-06-16 17:10 ` schwab@linux-m68k.org 2014-06-17 17:39 ` cvs-commit at gcc dot gnu.org 2014-06-25 19:23 ` cvs-commit at gcc dot gnu.org 2014-07-02 15:48 ` jmbnyc at gmail dot com 2014-07-02 16:19 ` bugdal at aerifal dot cx 2014-07-02 17:19 ` jmbnyc at gmail dot com [this message] 2014-07-02 18:07 ` bugdal at aerifal dot cx 2014-07-02 18:18 ` jmbnyc at gmail dot com 2014-07-03 3:13 ` andi-bz at firstfloor dot org 2014-07-03 3:25 ` jmbnyc at gmail dot com 2014-07-03 16:51 ` schwab@linux-m68k.org 2014-07-21 20:43 ` cvs-commit at gcc dot gnu.org 2014-08-19 0:36 ` cvs-commit at gcc dot gnu.org 2014-08-22 11:52 ` cvs-commit at gcc dot gnu.org 2014-08-25 13:05 ` cvs-commit at gcc dot gnu.org 2014-08-25 13:10 ` azanella at linux dot vnet.ibm.com 2014-10-01 18:43 ` carlos at redhat dot com 2014-10-01 20:49 ` schwab@linux-m68k.org 2014-10-01 21:00 ` carlos at redhat dot com 2014-10-01 21:04 ` azanella at linux dot vnet.ibm.com 2014-10-02 14:02 ` schwab@linux-m68k.org 2014-11-07 17:06 ` cvs-commit at gcc dot gnu.org 2014-12-11 11:45 ` cvs-commit at gcc dot gnu.org 2014-12-11 11:48 ` schwab@linux-m68k.org 2014-12-11 11:48 ` schwab@linux-m68k.org 2015-02-18 14:45 ` fweimer at redhat dot com 2015-08-28 20:43 ` cvs-commit at gcc dot gnu.org
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-16657-131-5czGH5cAIy@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /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: linkBe 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).