class: Win32OperatingSystem
authorStefan Vogel <sv@exept.de>
Tue, 15 Apr 2014 11:26:19 +0200
changeset 16334 41fddda3b611
parent 16333 4828c2efceeb
child 16335 8f156497ba5c
class: Win32OperatingSystem changed: #waitForMultipleObjects:withTimeout:
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Tue Apr 15 01:03:35 2014 +0200
+++ b/Win32OperatingSystem.st	Tue Apr 15 11:26:19 2014 +0200
@@ -11434,52 +11434,54 @@
     INT i, count;
 
     if (! __isArrayLike(fdOrHandleArray)) {
-	goto fail;
+        goto fail;
     }
     count = __arraySize(fdOrHandleArray);
 
     for (i=0; i<count; i++) {
-	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
-	HANDLE h;
-
-	if (__isExternalAddressLike(fdOrHandle)) {
-	    h = _HANDLEVal(fdOrHandle);
-	} else {
-	    if (__isSmallInteger(fdOrHandle)) {
-		h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
-	    } else {
-		goto fail;
-	    }
-	}
-	hArray[i] = h;
+        OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
+        HANDLE h;
+
+        if (fdOrHandle != nil) {
+            if (__isExternalAddressLike(fdOrHandle)) {
+                h = _HANDLEVal(fdOrHandle);
+            } else {
+                if (__isSmallInteger(fdOrHandle)) {
+                    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
+                } else {
+                    goto fail;
+                }
+            }
+            hArray[i] = h;
+        }
     }
 
     if (__isSmallInteger(millis)) {
-	t = __intVal(millis);
+        t = __intVal(millis);
     } else {
-	t = INFINITE;
+        t = INFINITE;
     }
 
 #ifdef DO_WRAP_CALLS
     do {
-	__threadErrno = 0;
-	// do not cast to INT - will loose sign bit then!
-	res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
+        __threadErrno = 0;
+        // do not cast to INT - will loose sign bit then!
+        res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
     } while ((res < 0) && (__threadErrno == EINTR));
 #else
     res = WaitForMultipleObjects(count, hArray, FALSE, t);
     if (res < 0) {
-	__threadErrno = __WIN32_ERR(GetLastError());
+        __threadErrno = __WIN32_ERR(GetLastError());
     }
 #endif
     if (res == WAIT_FAILED) {
-	RETURN (nil);
+        RETURN (nil);
     }
     if (res == WAIT_TIMEOUT) {
-	RETURN (nil);
+        RETURN (nil);
     }
     if ((res >= WAIT_OBJECT_0) && (res < (WAIT_OBJECT_0+count))) {
-	RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
+        RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
     }
 
     RETURN (nil);
@@ -16529,6 +16531,16 @@
     ^ pid
 ! !
 
+!Win32OperatingSystem::Win32ProcessHandle methodsFor:'comparing'!
+
+= aWin32ProcessHandle
+    ^ aWin32ProcessHandle class == self class and:[pid = aWin32ProcessHandle pid]
+!
+
+hash
+    ^ pid hash
+! !
+
 !Win32OperatingSystem::Win32ProcessHandle methodsFor:'printing & storing'!
 
 printOn:aStream
@@ -17605,15 +17617,15 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.498 2014-04-14 14:48:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.499 2014-04-15 09:26:19 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.498 2014-04-14 14:48:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.499 2014-04-15 09:26:19 stefan Exp $'
 !
 
 version_SVN
-    ^ '$Id: Win32OperatingSystem.st,v 1.498 2014-04-14 14:48:30 stefan Exp $'
+    ^ '$Id: Win32OperatingSystem.st,v 1.499 2014-04-15 09:26:19 stefan Exp $'
 
 ! !