FFmpeg
Functions
slicethread.c File Reference
#include <stdatomic.h>
#include "slicethread.h"
#include "mem.h"
#include "thread.h"
#include "avassert.h"

Go to the source code of this file.

Functions

int avpriv_slicethread_create (AVSliceThread **pctx, void *priv, void(*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), void(*main_func)(void *priv), int nb_threads)
 Create slice threading context. More...
 
void avpriv_slicethread_execute (AVSliceThread *ctx, int nb_jobs, int execute_main)
 Execute slice threading. More...
 
void avpriv_slicethread_free (AVSliceThread **pctx)
 Destroy slice threading context. More...
 

Function Documentation

◆ avpriv_slicethread_create()

int avpriv_slicethread_create ( AVSliceThread **  pctx,
void *  priv,
void(*)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)  worker_func,
void(*)(void *priv)  main_func,
int  nb_threads 
)

Create slice threading context.

Parameters
pctxslice threading context returned here
privprivate pointer to be passed to callback function
worker_funccallback function to be executed
main_funcspecial callback function, called from main thread, may be NULL
nb_threadsnumber of threads, 0 for automatic, must be >= 0
Returns
return number of threads or negative AVERROR on failure

Definition at line 236 of file slicethread.c.

Referenced by ff_slice_thread_init(), and thread_init_internal().

◆ avpriv_slicethread_execute()

void avpriv_slicethread_execute ( AVSliceThread ctx,
int  nb_jobs,
int  execute_main 
)

Execute slice threading.

Parameters
ctxslice threading context
nb_jobsnumber of jobs, must be > 0
execute_mainalso execute main_func

Definition at line 245 of file slicethread.c.

Referenced by thread_execute().

◆ avpriv_slicethread_free()

void avpriv_slicethread_free ( AVSliceThread **  pctx)

Destroy slice threading context.

Parameters
pctxpointer to context

Definition at line 250 of file slicethread.c.

Referenced by ff_slice_thread_free(), ff_slice_thread_init(), slice_thread_uninit(), and thread_init_internal().