OpenJPEG  2.4.0
Data Structures | Typedefs | Enumerations | Functions
thread.c File Reference
#include <assert.h>
#include "opj_includes.h"

Data Structures

struct  opj_tls_key_val_t
 
struct  opj_tls_t
 
struct  opj_worker_thread_job_t
 
struct  opj_worker_thread_t
 
struct  opj_job_list_t
 
struct  opj_worker_thread_list_t
 
struct  opj_thread_pool_t
 

Typedefs

typedef struct opj_job_list_t opj_job_list_t
 
typedef struct opj_worker_thread_list_t opj_worker_thread_list_t
 

Enumerations

enum  opj_worker_thread_state { OPJWTS_OK, OPJWTS_STOP, OPJWTS_ERROR }
 

Functions

OPJ_BOOL OPJ_CALLCONV opj_has_thread_support (void)
 Returns if the library is built with thread support. More...
 
int OPJ_CALLCONV opj_get_num_cpus (void)
 Return the number of virtual CPUs. 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...
 
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...
 
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...
 
static opj_tls_topj_tls_new (void)
 
static void opj_tls_destroy (opj_tls_t *tls)
 
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 opj_free_func)
 Set a thread local value corresponding to the provided key. More...
 
static OPJ_BOOL opj_thread_pool_setup (opj_thread_pool_t *tp, int num_threads)
 
static opj_worker_thread_job_topj_thread_pool_get_next_job (opj_thread_pool_t *tp, opj_worker_thread_t *worker_thread, OPJ_BOOL signal_job_finished)
 
opj_thread_pool_topj_thread_pool_create (int num_threads)
 Create a new thread pool. More...
 
static void opj_worker_thread_function (void *user_data)
 
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...
 

Typedef Documentation

Enumeration Type Documentation

Enumerator
OPJWTS_OK 
OPJWTS_STOP 
OPJWTS_ERROR 

Function Documentation

int OPJ_CALLCONV opj_get_num_cpus ( void  )

Return the number of virtual CPUs.

Referenced by opj_j2k_get_default_thread_count().

OPJ_BOOL OPJ_CALLCONV opj_has_thread_support ( void  )

Returns if the library is built with thread support.

OPJ_TRUE if mutex, condition, thread, thread pool are available.

References OPJ_FALSE.

Referenced by opj_j2k_get_default_thread_count(), and opj_j2k_set_threads().

static opj_worker_thread_job_t * opj_thread_pool_get_next_job ( opj_thread_pool_t tp,
opj_worker_thread_t worker_thread,
OPJ_BOOL  signal_job_finished 
)
static
static OPJ_BOOL opj_thread_pool_setup ( opj_thread_pool_t tp,
int  num_threads 
)
static
static void opj_tls_destroy ( opj_tls_t tls)
static
static opj_tls_t* opj_tls_new ( void  )
static
static void opj_worker_thread_function ( void *  user_data)
static