re PR go/48019 (Need to handle EINTR in libgo testsuite)
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Mar 2011 06:31:37 +0000 (06:31 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Mar 2011 06:31:37 +0000 (06:31 +0000)
PR go/48019
Ignore EINTR in runtime_lock_full.

From-SVN: r170810

libgo/runtime/thread.c

index b600754f64c1673fd5a33225a2993267692282c0..bac3f7dfdc1bbe0d8d3e30ddf414a73a1dbd2236 100644 (file)
@@ -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 <errno.h>
 #include "runtime.h"
 #include "go-assert.h"
 
@@ -32,8 +33,12 @@ static void runtime_lock_full(Lock *l) __attribute__ ((noinline));
 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