更新bug
This commit is contained in:
@@ -312,9 +312,14 @@ def run_async(
|
||||
on_error: Callable[[Exception], None] | None = None,
|
||||
on_finished: Callable[[], None] | None = None,
|
||||
pool: QThreadPool | None = None,
|
||||
priority: int = 0,
|
||||
**kwargs: Any,
|
||||
) -> Worker:
|
||||
"""Run ``function`` off the GUI thread and return its Worker handle."""
|
||||
"""Run ``function`` off the GUI thread and return its Worker handle.
|
||||
|
||||
Higher-priority queued work starts first when a pool thread becomes free.
|
||||
Running work is never interrupted.
|
||||
"""
|
||||
|
||||
worker = Worker(function, *args, **kwargs)
|
||||
_RUNNING_WORKERS.add(worker)
|
||||
@@ -324,7 +329,7 @@ def run_async(
|
||||
if on_finished is not None:
|
||||
worker.signals.finished.connect(on_finished)
|
||||
worker.signals.finished.connect(lambda: _RUNNING_WORKERS.discard(worker))
|
||||
(pool or QThreadPool.globalInstance()).start(worker)
|
||||
(pool or QThreadPool.globalInstance()).start(worker, priority)
|
||||
return worker
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user