diff options
Diffstat (limited to 'module/FileDatabase.py')
-rw-r--r-- | module/FileDatabase.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index a7d32b125..c89656407 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -474,16 +474,19 @@ class FileDatabaseBackend(Thread): def new(*args): args[0].lock.acquire() args[0].jobs.put((func, args, 0)) - sleep(0.001) # needed so that no thread takes result of other one + res = args[0].res.get() args[0].lock.release() - return args[0].res.get() + return res + return new def async(func): """use as decorator when function does not return anything and asynchron execution is wanted""" def new(*args): + args[0].lock.acquire() args[0].jobs.put((func, args, 1)) + args[0].lock.release() return True return new |