diff options
| author | Chris McDonough <chrism@plope.com> | 2015-05-14 02:57:35 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2015-05-14 02:57:35 -0400 |
| commit | 8d90c4fa61a6d3120a0f260651c91fd5cab453b4 (patch) | |
| tree | 22f31ae73fc76756f51d529e9795fe1f4df9ef3e /waitress/server.py | |
| parent | 228d068484b1fe253f35c4e367a5886332a0ed48 (diff) | |
| download | waitress-feature.exit-from-thread.tar.gz | |
dont translate KeyboardInterrupt in worker threads to thread.interrupt_main()feature.exit-from-thread
Diffstat (limited to 'waitress/server.py')
| -rw-r--r-- | waitress/server.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/waitress/server.py b/waitress/server.py index 8d0ba68..ade7b46 100644 --- a/waitress/server.py +++ b/waitress/server.py @@ -157,23 +157,23 @@ class BaseWSGIServer(logging_dispatcher, object): self.channel_class(self, conn, addr, self.adj, map=self._map) def run(self): + exitcode = 0 try: self.asyncore.loop( timeout=self.adj.asyncore_loop_timeout, map=self._map, use_poll=self.adj.asyncore_use_poll, ) + except (asyncore.ExitNow, SystemExit): + exitcode = 0 except KeyboardInterrupt: - # note that this is the codepath that will be executed both during - # an actual ctrl-C of a foregrounded program, when any task code - # raises KeyboardInterrupt in a thread, or when any subthread of - # this process calls thread.interrupt_main() + # note that this is the codepath that will be executed when SIGINT + # is sent to the main thread, when an actual ctrl-C is pressed on + # the console, or when thread.interrupt_main() is called from a + # subthread exitcode = 1 - except (SystemExit, asyncore.ExitNow): - # note that this is the codepath that will be executed when SIGTERM - # is sent to the main thread + finally: self.task_dispatcher.shutdown() - exitcode = 0 return exitcode def pull_trigger(self): |
