Method

GLibThreadPoolpush

Declaration

gboolean
g_thread_pool_push (
  GThreadPool* pool,
  gpointer data,
  GError** error
)

Description

Inserts data into the list of tasks to be executed by pool.

When the number of currently running threads is lower than the maximal allowed number of threads, a new thread is started (or reused) with the properties given to g_thread_pool_new(). Otherwise, data stays in the queue until a thread in this pool finishes its previous task and processes data.

error can be NULL to ignore errors, or non-NULL to report errors. An error can only occur when a new thread couldn’t be created. In that case data is simply appended to the queue of work to do.

Before version 2.32, this function did not return a success status.

Parameters

data

Type: gpointer

A new task for pool.

The argument can be NULL.
The data is owned by the caller of the function.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE on success, FALSE if an error occurred.