#REFACTORING by stefan
class: Win32OperatingSystem class
changed: #closePid:
class: Win32OperatingSystem::Win32ProcessHandle
added: #closeHandle
removed: #close
refactor previous change to use #closePid:
--- 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'!