2004-06-24 Dick Porter <dick@ximian.com>
authorDick Porter <dick@acm.org>
Thu, 24 Jun 2004 12:17:40 +0000 (12:17 -0000)
committerDick Porter <dick@acm.org>
Thu, 24 Jun 2004 12:17:40 +0000 (12:17 -0000)
* threads.c (SuspendThread):
* timed-thread.c (_wapi_timed_thread_suspend): Wrap sem_wait in a
while loop.  See bug 58161.

svn path=/trunk/mono/; revision=30291

mono/io-layer/ChangeLog
mono/io-layer/threads.c
mono/io-layer/timed-thread.c

index 3c873b74150a612cd713c1a59c2dad94924b27c1..2d18a35e39b070381b054fa24376a3e051c97434 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-24  Dick Porter  <dick@ximian.com>
+
+       * threads.c (SuspendThread): 
+       * timed-thread.c (_wapi_timed_thread_suspend): Wrap sem_wait in a
+       while loop.  See bug 58161.
 
 Wed Jun 23 23:29:04 CEST 2004 Paolo Molaro <lupus@ximian.com>
 
index b3e120743396805a56e43e9ddce947b3d7a9b6a1..b9ddc6aa3dc269737ebc7d15b1d0730872af3c03 100644 (file)
@@ -675,7 +675,11 @@ guint32 SuspendThread(gpointer handle)
                        _wapi_timed_thread_suspend (thread_private_handle->thread);
                else {
                        pthread_kill (thread_private_handle->thread->id, SIGPWR);
-                       MONO_SEM_WAIT (&thread_private_handle->thread->suspended_sem);
+                       while (MONO_SEM_WAIT (&thread_private_handle->thread->suspended_sem) != 0) {
+                               if (errno != EINTR) {
+                                       return(0xFFFFFFFF);
+                               }
+                       }
                }
        }
 
index 2ae57dd5cae104f4d5b81c66d737fe7a95021ab9..c0d737862a27678487afdd8a01ea7cccabcdbce5 100644 (file)
@@ -14,6 +14,7 @@
 #ifdef HAVE_SEMAPHORE_H
 #include <semaphore.h>
 #endif
+#include <errno.h>
 
 #include <mono/io-layer/processes.h>
 
@@ -295,7 +296,7 @@ void _wapi_timed_thread_suspend (TimedThread *thread)
                exit (-1);
        }
 
-       MONO_SEM_WAIT (&thread->suspend_sem);
+       while (MONO_SEM_WAIT (&thread->suspend_sem) != 0 && errno == EINTR);
 }
 
 void _wapi_timed_thread_resume (TimedThread *thread)