Function

GLibThreadPoolnew_full

Declaration

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

Description

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

Parameters

func GFunc
 

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

user_data 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.
item_free_func GDestroyNotify
 

Used to pass as a free function to g_async_queue_new_full()

max_threads gint
 

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

exclusive gboolean
 

Should this thread pool be exclusive?

error GError **
  The return location for a GError*, or NULL.

Return value

Returns: GThreadPool
 

The new GThreadPool.

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