From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30338 invoked by alias); 21 Nov 2011 14:59:00 -0000 Received: (qmail 30326 invoked by uid 22791); 21 Nov 2011 14:59:00 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Nov 2011 14:58:13 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/51249] semaphore implemetation for linux leaves threads blocked Date: Mon, 21 Nov 2011 15:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: amodra at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-11/txt/msg02120.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51249 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |rth at gcc dot gnu.org --- Comment #2 from Jakub Jelinek 2011-11-21 14:52:58 UTC --- Can you please clarify why do you think mutex is problematic too? When you do futex_wake in gomp_mutex_unlock_slow, you wake up one of the threads that are already blocked (i.e. have called futex_wait in gomp_mutex_lock_slow). But once it calls futex_wait, it breaks the first loop and keeps setting the mutex value to 2 rather than just 1. As for gomp_sem_{wait,post}, I guess libgomp's sem.[ch] has been written based on glibc before http://sources.redhat.com/git/?p=glibc.git;a=patch;h=3d2dd6ca71fa9933e3413625d606f4b486661409 changes (we always want private in libgomp, so those parts are non-issue, but the nwaiters maybe is). I'll need to think about this more when I'm not so sleepy.