Commit 6773c63c authored by Yann Leboulanger's avatar Yann Leboulanger

[Zhihao Yuan] ability to run a function in a thread without calling a callback.

parent 08020a31
......@@ -2899,13 +2899,14 @@ def _ok(passphrase, checked, count):
class ThreadInterface:
def __init__(self, func, func_args, callback, callback_args):
def __init__(self, func, func_args=(), callback=None, callback_args=()):
Call a function in a thread
def thread_function(func, func_args, callback, callback_args):
output = func(*func_args)
gobject.idle_add(callback, output, *callback_args)
if callback:
gobject.idle_add(callback, output, *callback_args)
Thread(target=thread_function, args=(func, func_args, callback,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment