From patchwork Wed Mar 9 06:31:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 86062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D2DEBB70CC for ; Wed, 9 Mar 2011 17:32:02 +1100 (EST) Received: (qmail 30913 invoked by alias); 9 Mar 2011 06:31:59 -0000 Received: (qmail 30905 invoked by uid 22791); 9 Mar 2011 06:31:57 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Mar 2011 06:31:50 +0000 Received: from wpaz13.hot.corp.google.com (wpaz13.hot.corp.google.com [172.24.198.77]) by smtp-out.google.com with ESMTP id p296Vmpe014507 for ; Tue, 8 Mar 2011 22:31:48 -0800 Received: from ywl2 (ywl2.prod.google.com [10.192.12.2]) by wpaz13.hot.corp.google.com with ESMTP id p296VlJf020299 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 8 Mar 2011 22:31:48 -0800 Received: by ywl2 with SMTP id 2so124033ywl.12 for ; Tue, 08 Mar 2011 22:31:47 -0800 (PST) Received: by 10.147.84.6 with SMTP id m6mr8877633yal.38.1299652307450; Tue, 08 Mar 2011 22:31:47 -0800 (PST) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id g31sm1088917yhd.26.2011.03.08.22.31.45 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 22:31:46 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Ignore EINTR in runtime_lock_full Date: Tue, 08 Mar 2011 22:31:42 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch to libgo ignores EINTR when calling sem_wait in runtime_lock_full. This is based on a patch from Rainer in PR 48019. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r bdcef618b22e libgo/runtime/thread.c --- a/libgo/runtime/thread.c Tue Mar 08 21:56:24 2011 -0800 +++ b/libgo/runtime/thread.c Tue Mar 08 22:29:23 2011 -0800 @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include #include "runtime.h" #include "go-assert.h" @@ -32,8 +33,12 @@ static void runtime_lock_full(Lock *l) { - if(sem_wait(&l->sem) != 0) - runtime_throw("sem_wait failed"); + for(;;){ + if(sem_wait(&l->sem) == 0) + return; + if(errno != EINTR) + runtime_throw("sem_wait failed"); + } } void