Use thread local to make environment threadsafe
Closed this issue · 1 comments
suned commented
Use thread local to make environment threadsafe
suned commented
Each thread must define their own environment
i.e this should fail:
def run():
Dependent().dependency # raises NoEnvironment
def run_with_own_env():
with Environment():
Dependent().dependency # ok
with Environment():
Thread(target=run).start()
Thread(target=run_with_own_env()).start()