OSDN Git Service

PR go/48019
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Mar 2011 06:31:37 +0000 (06:31 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Mar 2011 06:31:37 +0000 (06:31 +0000)
Ignore EINTR in runtime_lock_full.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170810 138bc75d-0d04-0410-961f-82ee72b054a4

libgo/runtime/thread.c

index b600754..bac3f7d 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