util.py 295 Bytes
Newer Older
segfault's avatar
segfault committed
1 2 3 4 5 6 7 8 9 10 11 12 13
import threading
from gi.repository import GLib


def run_threaded(function, *args):
    thread = threading.Thread(target=function, args=args)
    thread.start()


def process_mainloop_events():
    context = GLib.MainLoop().get_context()
    while context.pending():
        context.iteration()