since: 2.70


g_thread_pool_new_full (
  GFunc func,
  gpointer user_data,
  GDestroyNotify item_free_func,
  gint max_threads,
  gboolean exclusive,
  GError** error


This function creates a new thread pool similar to g_thread_pool_new() but allowing item_free_func to be specified to free the data passed to g_thread_pool_push() in the case that the GThreadPool is stopped and freed before all tasks have been executed.

Available since: 2.70

This function is not directly available to language bindings.



Type: GFunc

A function to execute in the threads of the new thread pool.


Type: gpointer

User data that is handed over to func every time it is called.

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

Type: GDestroyNotify

Used to pass as a free function to g_async_queue_new_full()


Type: gint

The maximal number of threads to execute concurrently in the new thread pool, -1 means no limit.


Type: gboolean

Should this thread pool be exclusive?


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 function 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: GThreadPool

The new GThreadPool.

The caller of the function takes ownership of the data, and is responsible for freeing it.