def start_daemon(): if SIMULATION_MODE: dprint('\n* In Simulation Mode: not starting daemon thread *\n') return global bgthread print('\nChecking daemon...') with thread_lock: if bgthread is None: # as this should run only once print('\nStarting background thread...\n') bgthread = socketio.start_background_task(bgtask)
def start_daemon(): global bgthread, TERMINATE if SIMULATION_MODE: dprint('\n* In Simulation Mode: not starting daemon thread *\n') return print('\nChecking daemon...') with thread_lock: if bgthread is None: # as this should run only once print('\nStarting background thread...\n') TERMINATE = False # reset the flag -it it was earlier stopped manually bgthread = socketio.start_background_task(bgtask) return {'result': True, 'msg': 'Worker thread started.'}