コード例 #1
0
ファイル: Bridge.py プロジェクト: ramanraja/Home5
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)
コード例 #2
0
ファイル: Bridge.py プロジェクト: ramanraja/Home6
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.'}