Signal sender threads to close on shutdown

- when shutdown is running, add a shutdown command to the queues of all
  sender threads
This commit is contained in:
Peter Šurda 2017-02-07 20:47:28 +01:00
parent a381f75b4b
commit 7da36eccbd
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -227,9 +227,12 @@ def doCleanShutdown():
# Wait long enough to guarantee that any running proof of work worker threads will check the
# shutdown variable and exit. If the main thread closes before they do then they won't stop.
from class_outgoingSynSender import outgoingSynSender
from class_sendDataThread import sendDataThread
for thread in threading.enumerate():
if isinstance(thread, sendDataThread):
thread.sendDataThreadQueue.put((0, 'shutdown','no data'))
if thread is not threading.currentThread() and isinstance(thread, StoppableThread) and not isinstance(thread, outgoingSynSender):
logger.debug("Waiting for thread %s",