Runs task_func in another thread. When task_func returns, task's
#GAsyncReadyCallback will be invoked in task's #GMainContext.
This takes a ref on task until the task completes.
See #GTaskThreadFunc for more details about how task_func is handled.
Although GLib currently rate-limits the tasks queued via
gio.task.Task.runInThread, you should not assume that it will always
do this. If you have a very large number of tasks to run (several tens of
tasks), but don't want them to all run at once, you should only queue a
limited number of them (around ten) at a time.
Be aware that if your task depends on other tasks to complete, use of this
function could lead to a livelock if the other tasks also use this function
and enough of them (around 10) execute in a dependency chain, as that will
exhaust the thread pool. If this situation is possible, consider using a
separate worker thread or thread pool explicitly, rather than using
gio.task.Task.runInThread.
Runs task_func in another thread. When task_func returns, task's #GAsyncReadyCallback will be invoked in task's #GMainContext.
This takes a ref on task until the task completes.
See #GTaskThreadFunc for more details about how task_func is handled.
Although GLib currently rate-limits the tasks queued via gio.task.Task.runInThread, you should not assume that it will always do this. If you have a very large number of tasks to run (several tens of tasks), but don't want them to all run at once, you should only queue a limited number of them (around ten) at a time.
Be aware that if your task depends on other tasks to complete, use of this function could lead to a livelock if the other tasks also use this function and enough of them (around 10) execute in a dependency chain, as that will exhaust the thread pool. If this situation is possible, consider using a separate worker thread or thread pool explicitly, rather than using gio.task.Task.runInThread.