Managing multiple asynchronous threads

No, more like this:

persist = system.util.persistent("someUniqueConstantName")
oldFileWatcher = persist.pop("fw")
persist['fw'] = FileWatcher(oldFileWatcher)

def getWatcher():
    return persist['fw']

Note the oldFileWatcher passed to the new one so the new one’s thread can tell it to shut down.

1 Like