### Function

# Vips ThreadpoolAllocateFn

#### Declaration

    int
    (* VipsThreadpoolAllocateFn) (
      VipsThreadState* state,
      void* a,
      gboolean* stop
    )

#### Description [src]

This function is called to allocate a new work unit for the thread. It is always single-threaded, so it can modify per-pool state (such as a counter).

It should set `stop` to `TRUE` to indicate that no work could be allocated because the job is done.

See also

`vips_threadpool_run()`.

#### Parameters

`state`

  Type: `VipsThreadState`

  Per-thread state.

  The data is owned by the caller of the function.

`a`

  Type: `void*`

  Client data.

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

`stop`

  Type: `gboolean*`

  Set this to signal end of computation.

  The data is owned by the caller of the function.

#### Return value

Type: `int`

0 on success, or -1 on error.