From patchwork Wed Mar 9 06:31:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: libgo patch committed: Ignore EINTR in runtime_lock_full Date: Tue, 08 Mar 2011 20:31:42 -0000 From: Ian Taylor X-Patchwork-Id: 86062 Message-Id: To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com 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