OpenJPEG  2.2.0
thread.h File Reference

Thread API. More...

#include "openjpeg.h"

Go to the source code of this file.

Mutex

typedef struct opj_mutex_t opj_mutex_t
 Opaque type for a mutex. More...
 
opj_mutex_topj_mutex_create (void)
 Creates a mutex. More...
 
void opj_mutex_lock (opj_mutex_t *mutex)
 Lock/acquire the mutex. More...
 
void opj_mutex_unlock (opj_mutex_t *mutex)
 Unlock/release the mutex. More...
 
void opj_mutex_destroy (opj_mutex_t *mutex)
 Destroy a mutex. More...
 

Condition

typedef struct opj_cond_t opj_cond_t
 Opaque type for a condition. More...
 
opj_cond_topj_cond_create (void)
 Creates a condition. More...
 
void opj_cond_wait (opj_cond_t *cond, opj_mutex_t *mutex)
 Wait for the condition to be signaled. More...
 
void opj_cond_signal (opj_cond_t *cond)
 Signal waiting threads on a condition. More...
 
void opj_cond_destroy (opj_cond_t *cond)
 Destroy a condition. More...
 

Thread

typedef struct opj_thread_t opj_thread_t
 Opaque type for a thread handle. More...
 
typedef void(* opj_thread_fn) (void *user_data)
 User function to execute in a thread. More...
 
opj_thread_topj_thread_create (opj_thread_fn thread_fn, void *user_data)
 Creates a new thread. More...
 
void opj_thread_join (opj_thread_t *thread)
 Wait for a thread to be finished and release associated resources to the thread handle. More...
 

Thread local storage

typedef struct opj_tls_t opj_tls_t
 Opaque type for a thread local storage. More...
 
typedef void(* opj_tls_free_func) (void *value)
 Type of the function used to free a TLS value. More...
 
void * opj_tls_get (opj_tls_t *tls, int key)
 Get a thread local value corresponding to the provided key. More...
 
OPJ_BOOL opj_tls_set (opj_tls_t *tls, int key, void *value, opj_tls_free_func free_func)
 Set a thread local value corresponding to the provided key. More...
 

Thread pool

typedef struct opj_thread_pool_t opj_thread_pool_t
 Opaque type for a thread pool. More...
 
typedef void(* opj_job_fn) (void *user_data, opj_tls_t *tls)
 User function to execute in a thread. More...
 
opj_thread_pool_topj_thread_pool_create (int num_threads)
 Create a new thread pool. More...
 
OPJ_BOOL opj_thread_pool_submit_job (opj_thread_pool_t *tp, opj_job_fn job_fn, void *user_data)
 Submit a new job to be run by one of the thread in the thread pool. More...
 
void opj_thread_pool_wait_completion (opj_thread_pool_t *tp, int max_remaining_jobs)
 Wait that no more than max_remaining_jobs jobs are remaining in the queue of the thread pool. More...
 
int opj_thread_pool_get_thread_count (opj_thread_pool_t *tp)
 Return the number of threads associated with the thread pool. More...
 
void opj_thread_pool_destroy (opj_thread_pool_t *tp)
 Destroy a thread pool. More...
 

Detailed Description

Thread API.

The functions in thread.c have for goal to manage mutex, conditions, thread creation and thread pools that accept jobs.