### Function

# GLib ThreadPool new_full

since: 2.70

#### 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.

`item_free_func` will not be called on items successfully passed to `func`. `func` is responsible for freeing the items passed to it.

Available since: 2.70

This function is not directly available to language bindings.

#### Parameters

`func`

  Type: `GFunc`

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

`user_data`

  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.

`item_free_func`

  Type: `GDestroyNotify`

  Used to pass as a free function to `g_async_queue_new_full()`

`max_threads`

  Type: `gint`

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

`exclusive`

  Type: `gboolean`

  Should this thread pool be exclusive?

`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 be 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.