#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Tue, 22 Jan 2019 19:33:56 +0100
changeset 23638 37512eec04c2
parent 23637 8b59f50ab857
child 23639 3b68a1b098c5
#REFACTORING by stefan class: Win32OperatingSystem class changed: #closePid: class: Win32OperatingSystem::Win32ProcessHandle added: #closeHandle removed: #close refactor previous change to use #closePid:
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Tue Jan 22 19:32:39 2019 +0100
+++ b/Win32OperatingSystem.st	Tue Jan 22 19:33:56 2019 +0100
@@ -8045,24 +8045,25 @@
 closePid:pid
     "free pid resource"
 %{
-    if (__isExternalAddressLike(pid) ) {
-	HANDLE __pid = _HANDLEVal(pid);
-
-	if (__pid != 0) {
+    HANDLE __pid;
+
+    if (!__isExternalAddressLike(pid) || (__pid = _HANDLEVal(pid)) == 0) {
+        RETURN(self);
+    }    
+
 #ifdef PROCESSDEBUGWIN32
-	    if (flag_PROCESSDEBUGWIN32) {
-		console_printf("Close ProcessHandle %x\n", __pid);
-	    }
-#endif
-	    CloseHandle(__pid);
-	    _SETHANDLEVal(pid, 0);
-	}
-    }
-%}.
-    ^ true.
-
-    "Created: 28.1.1998 / 14:23:04 / md"
-    "Modified: 28.1.1998 / 14:27:18 / md"
+    if (flag_PROCESSDEBUGWIN32) {
+        console_printf("Close ProcessHandle %x\n", __pid);
+    }
+#endif
+    CloseHandle(__pid);
+    _SETHANDLEVal(pid, 0);
+%}.
+
+    pid unregisterForFinalization.
+
+    "Created: / 28-01-1998 / 14:23:04 / md"
+    "Modified: / 22-01-2019 / 19:30:27 / Stefan Vogel"
 !
 
 duplicateHandle:aHandle to:targetProcessHandle
@@ -18879,9 +18880,10 @@
 
 !Win32OperatingSystem::Win32ProcessHandle methodsFor:'release'!
 
-close
-    self closeHandle.
-    self unregisterForFinalization.
+closeHandle
+    OperatingSystem closePid:self.
+
+    "Created: / 22-01-2019 / 19:17:15 / Stefan Vogel"
 ! !
 
 !Win32OperatingSystem::Win32SerialPortHandle methodsFor:'opening'!