Multithreading

Multithreading. More...

## Typedefs

typedef void(* | gavl_video_process_func) (void *data, int start, int end)
| Prototype of a process function. More...
typedef void(* | gavl_video_run_func) (gavl_video_process_func func, void *gavl_data, int start, int end, void *client_data, int thread)
| Run a piece of a calculation. More...
typedef void(* | gavl_video_stop_func) (void *client_data, int thread)
| Wait until a piece of a calculation finished. More...

## Detailed Description

Multithreading.

gavl has generic multithreading support for video processing. It's done by splitting the calculations in smaller pieces (usually slices of the destination images) and calling user supplied functions, which can transfer the tasks to worker threads. Multithreading is configured with gavl_video_options_set_num_threads, gavl_video_options_set_run_func and gavl_video_options_set_stop_func

## Typedef Documentation

## gavl_video_process_func

typedef void(* gavl_video_process_func) (void *data, int start, int end)

Prototype of a process function.

Parameters

  data | Private data
  start | Where the function should start
  end | Where the function should end (exclusive)

This function is supplied by gavl and passed to the application, which then executes multiple instances of the functions in multiple threads

## gavl_video_run_func

typedef void(* gavl_video_run_func) (gavl_video_process_func func, void *gavl_data, int start, int end, void *client_data, int thread)

Run a piece of a calculation.

Parameters

  func | Function to execute
  gavl_data | 1. Argument for func
  start | 2. Argument for func
  end | 3. Argument for func
  client_data | Data passed with gavl_video_options_set_run_func
  thread | Number of processing thread (starting with 0)

This function supplied by the application and passed to gavl via gavl_video_options_set_run_func. It should call func with the given parameters in a worker thread.

## gavl_video_stop_func

typedef void(* gavl_video_stop_func) (void *client_data, int thread)

Wait until a piece of a calculation finished.

client_data Data passed with gavl_video_options_set_stop_func

Parameters

  thread | Number of processing thread (starting with 0)

This function must make sure that the task started by gavl_video_run_func is finished.