Commit 5507592c authored by Stephan Richter's avatar Stephan Richter

Provide a way to shutdown the servers using an exit status.

parent 6350d155
......@@ -25,7 +25,7 @@ register_loop_callback() to register interest. When the mainloop
thread calls loop(), each registered callback will be called with the
socket map as its first argument.
"""
__version__ = '$Revision: 1.12 $'[11:-2]
__version__ = '$Revision: 1.13 $'[11:-2]
import asyncore
import select
......@@ -150,6 +150,9 @@ def loop(timeout=30.0, use_poll=0, map=None):
except that it also triggers ThreadedAsync callback functions
before starting the loop.
"""
global exit_status
exit_status = None
if use_poll:
if hasattr(select, 'poll'):
poll_fun = asyncore.poll3
......@@ -162,7 +165,7 @@ def loop(timeout=30.0, use_poll=0, map=None):
map = asyncore.socket_map
_start_loop(map)
while map:
while map and exit_status is None:
poll_fun(timeout, map)
_stop_loop()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment