2010-04-08 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 8 Apr 2010 20:01:04 +0000 (20:01 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 8 Apr 2010 20:01:04 +0000 (20:01 -0000)
* mono-semaphore.c: set EINTR on windows too.

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

mono/utils/ChangeLog
mono/utils/mono-semaphore.c

index 3b55206b62c53c2bc1ef6b34c7672c927136c80a..2b1fc6146cedaba6630db5c917ff6edf377f381d 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-08 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * mono-semaphore.c: set EINTR on windows too.
+
 2010-04-01 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * mono-semaphore.c: patch from Robert Nagy that makes this work in
index c6bf58885c552ae8a5b31958827aa07c21b71a98..58c4fc9f9e63544070fa6bfc88048a6eb7fda6fc 100644 (file)
@@ -119,9 +119,16 @@ mono_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, gboolean alertable)
        gboolean res;
 
        res = WaitForSingleObjectEx (*sem, timeout_ms, alertable);
-       if (!res)
+       switch (res) {
+       case WAIT_OBJECT_0:
+               return 0;
+       case WAIT_IO_COMPLETION:
+               errno = EINTR;
+               return -1;            
+       // WAIT_TIMEOUT and WAIT_FAILED
+       default:
                return -1;
-       return 0;
+       }
 }
 
 int