Vips.threadpool_run (original) (raw)

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 callsstart to create new per-thread state, then runsallocate 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 ofVipsThreadState. 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

Return value

Type: int

0 on success, or -1 on error.