Commits  committed 737b29f

Reactor.shutdown() takes optional parameter to shutdown threadpool. Reactor.shutdown() returns True on success.

  • Participants
  • Parent commits 295f089
  • Branches default

Comments (0)

Files changed (2)

File asyncthreads/

         # was removed.
         return tmp_future.result()
-    def shutdown(self):
+    def shutdown(self, shutdown_threadpool=True):
         """Cause the reactor thread to exit gracefully.
+        Arguments:
+        shutdown_threadpool -- If True, and Reactor is using a ThreadPool, then
+                               shutdown the ThreadPool.  Set this to false if
+                               the ThreadPool instance is still in use outside
+                               of this Reactor.
+        Return:
+        True if shutdown, False if Reactor not started.
         if not self.is_alive():
             #print "thread is not started"
         # Shutdown threadpool after reactor main thread has exited to ensure no
         # more tasks are submitted to the thread pool.
-        if self._thread_pool is not None:
+        if self._thread_pool is not None and shutdown_threadpool:
+        return True
     def qsize(self):
         """Return number of items in the message queue."""
         return self._call_queue.qsize()
 def main():
-        version= '1.4.2',
+        version= '1.4.3',
         author='Andrew Gillis',