##// END OF EJS Templates
attempt to suppress exceptions in daemon threads at shutdown...
MinRK -
Show More
@@ -16,6 +16,7 b' TODO'
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17
17
18 # Standard library imports.
18 # Standard library imports.
19 import atexit
19 import errno
20 import errno
20 import json
21 import json
21 from subprocess import Popen
22 from subprocess import Popen
@@ -91,6 +92,7 b' class ZMQSocketChannel(Thread):'
91 ioloop = None
92 ioloop = None
92 stream = None
93 stream = None
93 _address = None
94 _address = None
95 _exiting = False
94
96
95 def __init__(self, context, session, address):
97 def __init__(self, context, session, address):
96 """Create a channel
98 """Create a channel
@@ -113,6 +115,10 b' class ZMQSocketChannel(Thread):'
113 message = 'The port number for a channel cannot be 0.'
115 message = 'The port number for a channel cannot be 0.'
114 raise InvalidPortNumber(message)
116 raise InvalidPortNumber(message)
115 self._address = address
117 self._address = address
118 atexit.register(self._notice_exit)
119
120 def _notice_exit(self):
121 self._exiting = True
116
122
117 def _run_loop(self):
123 def _run_loop(self):
118 """Run my loop, ignoring EINTR events in the poller"""
124 """Run my loop, ignoring EINTR events in the poller"""
@@ -124,6 +130,11 b' class ZMQSocketChannel(Thread):'
124 continue
130 continue
125 else:
131 else:
126 raise
132 raise
133 except Exception:
134 if self._exiting:
135 break
136 else:
137 raise
127 else:
138 else:
128 break
139 break
129
140
@@ -517,6 +528,11 b' class HBSocketChannel(ZMQSocketChannel):'
517 pass
528 pass
518 else:
529 else:
519 raise
530 raise
531 except Exception:
532 if self._exiting:
533 break
534 else:
535 raise
520 else:
536 else:
521 break
537 break
522 return events
538 return events
General Comments 0
You need to be logged in to leave comments. Login now