TUT HEVC Encoder
Loading...
Searching...
No Matches
Typedefs | Functions
threadqueue.h File Reference

Container for worker tasks. More...

#include "global.h"
#include <pthread.h>
Include dependency graph for threadqueue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct threadqueue_job_t threadqueue_job_t
 
typedef struct threadqueue_queue_t threadqueue_queue_t
 

Functions

threadqueue_queue_tkvz_threadqueue_init (int thread_count)
 Initialize the queue.
 
threadqueue_job_tkvz_threadqueue_job_create (void(*fptr)(void *arg), void *arg)
 Create a job and return a pointer to it.
 
int kvz_threadqueue_submit (threadqueue_queue_t *threadqueue, threadqueue_job_t *job)
 
int kvz_threadqueue_job_dep_add (threadqueue_job_t *job, threadqueue_job_t *dependency)
 Add a dependency between two jobs.
 
threadqueue_job_tkvz_threadqueue_copy_ref (threadqueue_job_t *job)
 Get a new pointer to a job.
 
void kvz_threadqueue_free_job (threadqueue_job_t **job_ptr)
 Free a job.
 
int kvz_threadqueue_waitfor (threadqueue_queue_t *threadqueue, threadqueue_job_t *job)
 Wait for a job to be completed.
 
int kvz_threadqueue_stop (threadqueue_queue_t *threadqueue)
 Stop all threads after they finish the current jobs.
 
void kvz_threadqueue_free (threadqueue_queue_t *threadqueue)
 Stop all threads and free allocated resources.
 

Typedef Documentation

◆ threadqueue_job_t

◆ threadqueue_queue_t

Function Documentation

◆ kvz_threadqueue_copy_ref()

threadqueue_job_t * kvz_threadqueue_copy_ref ( threadqueue_job_t job)

Increment reference count and return the job.

Here is the caller graph for this function:

◆ kvz_threadqueue_free()

void kvz_threadqueue_free ( threadqueue_queue_t threadqueue)
Returns
1 on success, 0 on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_threadqueue_free_job()

void kvz_threadqueue_free_job ( threadqueue_job_t **  job_ptr)

Decrement reference count of the job. If no references exist any more, deallocate associated memory and destroy mutexes.

Sets the job pointer to NULL.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_threadqueue_init()

threadqueue_queue_t * kvz_threadqueue_init ( int  thread_count)
Returns
1 on success, 0 on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_threadqueue_job_create()

threadqueue_job_t * kvz_threadqueue_job_create ( void(*)(void *arg)  fptr,
void arg 
)

The job is created in a paused state. Function kvz_threadqueue_submit must be called on the job in order to have it run.

Returns
pointer to the job, or NULL on failure
Here is the caller graph for this function:

◆ kvz_threadqueue_job_dep_add()

int kvz_threadqueue_job_dep_add ( threadqueue_job_t job,
threadqueue_job_t dependency 
)
Parameters
jobjob that should be executed after dependency
dependencyjob that should be executed before job
Returns
1 on success, 0 on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_threadqueue_stop()

int kvz_threadqueue_stop ( threadqueue_queue_t *const  threadqueue)

Block until all threads have stopped.

Returns
1 on success, 0 on failure
Here is the caller graph for this function:

◆ kvz_threadqueue_submit()

int kvz_threadqueue_submit ( threadqueue_queue_t threadqueue,
threadqueue_job_t job 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_threadqueue_waitfor()

int kvz_threadqueue_waitfor ( threadqueue_queue_t threadqueue,
threadqueue_job_t job 
)
Returns
1 on success, 0 on failure
Here is the caller graph for this function: