Runtime: avoids using "pipe to self" bailout unblocking trick on windows, since select() only takes sockets.
--- a/runtime/PyroServer.py Tue Oct 19 15:15:03 2021 +0200
+++ b/runtime/PyroServer.py Tue Sep 07 09:08:40 2021 +0200
@@ -62,8 +62,15 @@
self.daemon.connect(pyro_obj, "PLCObject")
when_ready()
- self.piper, self.pipew = os.pipe()
- self.daemon.requestLoop(others=[self.piper], callback=lambda x: None)
+
+ # "pipe to self" trick to to accelerate runtime shutdown
+ # instead of waiting for arbitrary pyro timeout.
+ others = []
+ if not sys.platform.startswith('win'):
+ self.piper, self.pipew = os.pipe()
+ others.append = self.piper
+
+ self.daemon.requestLoop(others=others, callback=lambda x: None)
self.piper, self.pipew = None, None
if hasattr(self, 'sock'):
self.daemon.sock.close()
@@ -76,8 +83,9 @@
self.continueloop = False
self.daemon.shutdown(True)
self.daemon.closedown()
- if self.pipew is not None:
- os.write(self.pipew, "goodbye")
+ if not sys.platform.startswith('win'):
+ if self.pipew is not None:
+ os.write(self.pipew, "goodbye")
def Publish(self):
self.servicepublisher = ServicePublisher("PYRO")