|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
"""shutdown function"""
|
|
|
|
|
import os
|
|
|
|
|
import Queue
|
|
|
|
|
import threading
|
|
|
|
@ -15,8 +16,7 @@ from queues import (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def doCleanShutdown():
|
|
|
|
|
# Used to tell proof of work worker threads
|
|
|
|
|
# and the objectProcessorThread to exit.
|
|
|
|
|
"""Used to tell proof of work worker threads and the objectProcessorThread to exit."""
|
|
|
|
|
state.shutdown = 1
|
|
|
|
|
|
|
|
|
|
objectProcessorQueue.put(('checkShutdownVariable', 'no data'))
|
|
|
|
@ -53,7 +53,7 @@ def doCleanShutdown():
|
|
|
|
|
|
|
|
|
|
for thread in threading.enumerate():
|
|
|
|
|
if (thread is not threading.currentThread() and
|
|
|
|
|
isinstance(thread, StoppableThread) and
|
|
|
|
|
isinstance(thread, StoppableThread) and
|
|
|
|
|
thread.name != 'SQL'):
|
|
|
|
|
logger.debug("Waiting for thread %s", thread.name)
|
|
|
|
|
thread.join()
|
|
|
|
@ -76,10 +76,10 @@ def doCleanShutdown():
|
|
|
|
|
except Queue.Empty:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
if shared.thisapp.daemon or not state.enableGUI: # FIXME redundant?
|
|
|
|
|
if shared.thisapp.daemon or not state.enableGUI: # ..fixme:: redundant?
|
|
|
|
|
logger.info('Clean shutdown complete.')
|
|
|
|
|
shared.thisapp.cleanup()
|
|
|
|
|
os._exit(0)
|
|
|
|
|
os._exit(0) # pylint: disable=protected-access
|
|
|
|
|
else:
|
|
|
|
|
logger.info('Core shutdown complete.')
|
|
|
|
|
for thread in threading.enumerate():
|
|
|
|
|