#BUGFIX by stefan
authorStefan Vogel <sv@exept.de>
Wed, 04 Mar 2020 16:54:15 +0100
changeset 25316 309e03382ce2
parent 25315 8227a9ce831d
child 25317 245086b1bfe6
#BUGFIX by stefan class: AbstractOperatingSystem class changed: #readCheck: #readWriteCheck: #writeCheck: #writeExceptionCheck: handle nil fd
AbstractOperatingSystem.st
--- a/AbstractOperatingSystem.st	Tue Mar 03 17:50:41 2020 +0100
+++ b/AbstractOperatingSystem.st	Wed Mar 04 16:54:15 2020 +0100
@@ -8146,23 +8146,30 @@
 
     |result|
 
+    fd isNil ifTrue:[
+        "read on nil fd fails immediately"
+        ^ true.
+    ].    
+
     self supportsSelect ifFalse:[
-	"/ mhmh - what should we do then ?
-	"/ For now, return true as if data was present,
-	"/ and let the thread fall into the read.
-	"/ It will then (hopefully) be descheduled there and
-	"/ effectively polling for input.
-
-	^ true
+        "/ mhmh - what should we do then ?
+        "/ For now, return true as if data was present,
+        "/ and let the thread fall into the read.
+        "/ It will then (hopefully) be descheduled there and
+        "/ effectively polling for input.
+
+        ^ true
     ].
 
     result := self
-		selectOnAnyReadable:(Array with:fd) writable:nil exception:nil
-		readableInto:nil writableInto:nil exceptionInto:nil
-		withTimeOut:0.
+                selectOnAnyReadable:(Array with:fd) writable:nil exception:nil
+                readableInto:nil writableInto:nil exceptionInto:nil
+                withTimeOut:0.
 
     "on select error, a read will immediately return, so answer true"
     ^ result ~~ 0.
+
+    "Modified: / 04-03-2020 / 14:38:05 / Stefan Vogel"
 !
 
 readWriteCheck:fd
@@ -8174,24 +8181,30 @@
 
     |result fdArray|
 
+    fd isNil ifTrue:[
+        "read or write will return without wait (with error)"
+        ^ true.
+    ].    
+
     self supportsSelect ifFalse:[
-	"/ mhmh - what should we do then ?
-	"/ For now, return true as if data was present,
-	"/ and let the thread fall into the write.
-	"/ It will then (hopefully) be desceduled there and
-	"/ effectively polling for output.
-	^ true
+        "/ mhmh - what should we do then ?
+        "/ For now, return true as if data was present,
+        "/ and let the thread fall into the write.
+        "/ It will then (hopefully) be desceduled there and
+        "/ effectively polling for output.
+        ^ true
     ].
 
     result := self
-		selectOnAnyReadable:(fdArray := Array with:fd) writable:fdArray exception:nil
-		readableInto:nil writableInto:nil exceptionInto:nil
-		withTimeOut:0.
+                selectOnAnyReadable:(fdArray := Array with:fd) writable:fdArray exception:nil
+                readableInto:nil writableInto:nil exceptionInto:nil
+                withTimeOut:0.
 
     "on select error, a read will immediately return, so answer true"
     ^ result ~~ 0.
 
     "Modified: / 03-05-2018 / 14:29:40 / stefan"
+    "Modified (format): / 04-03-2020 / 14:42:26 / Stefan Vogel"
 !
 
 selectOn:fd1 and:fd2 withTimeOut:millis
@@ -8337,24 +8350,30 @@
 
     |result|
 
+    fd isNil ifTrue:[
+        "write will return without wait (with error)"
+        ^ true.
+    ].    
+
     self supportsSelect ifFalse:[
-	"/ mhmh - what should we do then ?
-	"/ For now, return true as if data was present,
-	"/ and let the thread fall into the write.
-	"/ It will then (hopefully) be descheduled there and
-	"/ effectively polling for output.
-	^ true
+        "/ mhmh - what should we do then ?
+        "/ For now, return true as if data was present,
+        "/ and let the thread fall into the write.
+        "/ It will then (hopefully) be descheduled there and
+        "/ effectively polling for output.
+        ^ true
     ].
 
     result := self
-		selectOnAnyReadable:nil writable:(Array with:fd) exception:nil
-		readableInto:nil writableInto:nil exceptionInto:nil
-		withTimeOut:0.
+                selectOnAnyReadable:nil writable:(Array with:fd) exception:nil
+                readableInto:nil writableInto:nil exceptionInto:nil
+                withTimeOut:0.
 
     "on select error, a write will immediately return, so answer true"
     ^ result ~~ 0.
 
     "Modified (format): / 19-04-2018 / 11:57:26 / stefan"
+    "Modified (format): / 04-03-2020 / 14:44:26 / Stefan Vogel"
 !
 
 writeExceptionCheck:fd
@@ -8367,24 +8386,30 @@
 
     |result fdArray|
 
+    fd isNil ifTrue:[
+        "write will return without wait (with error)"
+        ^ true.
+    ].    
+    
     self supportsSelect ifFalse:[
-	"/ mhmh - what should we do then ?
-	"/ For now, return true as if data was present,
-	"/ and let the thread fall into the write.
-	"/ It will then (hopefully) be descheduled there and
-	"/ effectively polling for output.
-	^ true
+        "/ mhmh - what should we do then ?
+        "/ For now, return true as if data was present,
+        "/ and let the thread fall into the write.
+        "/ It will then (hopefully) be descheduled there and
+        "/ effectively polling for output.
+        ^ true
     ].
 
     result := self
-		selectOnAnyReadable:nil writable:(fdArray := Array with:fd) exception:fdArray
-		readableInto:nil writableInto:nil exceptionInto:nil
-		withTimeOut:0.
+                selectOnAnyReadable:nil writable:(fdArray := Array with:fd) exception:fdArray
+                readableInto:nil writableInto:nil exceptionInto:nil
+                withTimeOut:0.
 
     "on select error, a write will immediately return, so answer true"
     ^ result ~~ 0.
 
     "Modified (format): / 19-04-2018 / 11:57:20 / stefan"
+    "Modified: / 04-03-2020 / 14:43:35 / Stefan Vogel"
 ! !
 
 !AbstractOperatingSystem::PrinterInfo class methodsFor:'constants'!