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.
opj_mutex_topj_mutex_create (void)
 Creates a mutex.
void opj_mutex_lock (opj_mutex_t *mutex)
 Lock/acquire the mutex.
void opj_mutex_unlock (opj_mutex_t *mutex)
 Unlock/release the mutex.
void opj_mutex_destroy (opj_mutex_t *mutex)
 Destroy a mutex.

Condition



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

Thread



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

Thread local storage



typedef struct opj_tls_t opj_tls_t
 Opaque type for a thread local storage.
typedef void(* opj_tls_free_func )(void *value)
 Type of the function used to free a TLS value.
void * opj_tls_get (opj_tls_t *tls, int key)
 Get a thread local value corresponding to the provided key.
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.

Thread pool



typedef struct opj_thread_pool_t opj_thread_pool_t
 Opaque type for a thread pool.
typedef void(* opj_job_fn )(void *user_data, opj_tls_t *tls)
 User function to execute in a thread.
opj_thread_pool_topj_thread_pool_create (int num_threads)
 Create a new thread pool.
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.
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.
int opj_thread_pool_get_thread_count (opj_thread_pool_t *tp)
 Return the number of threads associated with the thread pool.
void opj_thread_pool_destroy (opj_thread_pool_t *tp)
 Destroy a thread pool.

Detailed Description

Thread API.

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


Generated on 20 Feb 2018 for OpenJPEG by  doxygen 1.6.1