Method

GioTaskrun_in_thread_sync

since: 2.36

Declaration

void
g_task_run_in_thread_sync (
  GTask* task,
  GTaskThreadFunc task_func
)

Description

Runs task_func in another thread, and waits for it to return or be cancelled. You can use g_task_propagate_pointer(), etc, afterward to get the result of task_func.

See GTaskThreadFunc for more details about how task_func is handled.

Normally this is used with tasks created with a NULL callback, but note that even if the task does have a callback, it will not be invoked when task_func returns. GTask:completed will be set to TRUE just before this function returns.

Although GLib currently rate-limits the tasks queued via g_task_run_in_thread_sync(), you should not assume that it will always do this. If you have a very large number of tasks to run, but don’t want them to all run at once, you should only queue a limited number of them at a time.

Available since: 2.36

Parameters

task_func

Type: GTaskThreadFunc

A GTaskThreadFunc.