Function

Vipsthreadpool_run

Declaration [src]

int
vips_threadpool_run (
  VipsImage* im,
  VipsThreadStartFn start,
  VipsThreadpoolAllocateFn allocate,
  VipsThreadpoolWorkFn work,
  VipsThreadpoolProgressFn progress,
  void* a
)

Description [src]

This function runs a set of threads over an image. Each thread first calls start to create new per-thread state, then runs allocate to set up a new work unit (perhaps the next tile in an image, for example), then work to process that work unit. After each unit is processed, progress is called, so that the operation can give progress feedback. progress may be NULL.

The object returned by start must be an instance of a subclass of VipsThreadState. Use this to communicate between allocate and work.

allocate and start are always single-threaded (so they can write to the per-pool state), whereas work can be executed concurrently. progress is always called by the main thread (ie. the thread which called vips_threadpool_run()).

This function is not directly available to language bindings.

Parameters

im

Type: VipsImage

Image to loop over.

The data is owned by the caller of the function.
start

Type: VipsThreadStartFn

Allocate per-thread state.

allocate

Type: VipsThreadpoolAllocateFn

Allocate a work unit.

work

Type: VipsThreadpoolWorkFn

Process a work unit.

progress

Type: VipsThreadpoolProgressFn

Give progress feedback about a work unit, or NULL.

a

Type: void*

Client data.

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

Return value

Type: int

0 on success, or -1 on error.