238 int max_remaining_jobs);
void(* opj_job_fn)(void *user_data, opj_tls_t *tls)
User function to execute in a thread.
Definition: thread.h:213
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.
Definition: thread.c:820
int OPJ_BOOL
Definition: openjpeg.h:110
opj_thread_pool_t * opj_thread_pool_create(int num_threads)
Create a new thread pool.
Definition: thread.c:620
opj_cond_t * opj_cond_create(void)
Creates a condition.
Definition: thread.c:458
void opj_cond_wait(opj_cond_t *cond, opj_mutex_t *mutex)
Wait for the condition to be signaled.
Definition: thread.c:463
void(* opj_thread_fn)(void *user_data)
User function to execute in a thread.
Definition: thread.h:146
void(* opj_tls_free_func)(void *value)
Type of the function used to free a TLS value.
Definition: thread.h:177
void opj_cond_destroy(opj_cond_t *cond)
Destroy a condition.
Definition: thread.c:474
struct opj_cond_t opj_cond_t
Opaque type for a condition.
Definition: thread.h:81
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.
Definition: thread.c:535
int opj_thread_pool_get_thread_count(opj_thread_pool_t *tp)
Return the number of threads associated with the thread pool.
Definition: thread.c:907
opj_thread_t * opj_thread_create(opj_thread_fn thread_fn, void *user_data)
Creates a new thread.
Definition: thread.c:479
void opj_mutex_destroy(opj_mutex_t *mutex)
Destroy a mutex.
Definition: thread.c:453
void opj_cond_signal(opj_cond_t *cond)
Signal waiting threads on a condition.
Definition: thread.c:469
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...
Definition: thread.c:887
struct opj_mutex_t opj_mutex_t
Opaque type for a mutex.
Definition: thread.h:52
struct opj_thread_t opj_thread_t
Opaque type for a thread handle.
Definition: thread.h:141
opj_mutex_t * opj_mutex_create(void)
Creates a mutex.
Definition: thread.c:438
void opj_mutex_unlock(opj_mutex_t *mutex)
Unlock/release the mutex.
Definition: thread.c:448
opj_tls_t * tls
Definition: thread.c:610
void * opj_tls_get(opj_tls_t *tls, int key)
Get a thread local value corresponding to the provided key.
Definition: thread.c:524
void opj_thread_join(opj_thread_t *thread)
Wait for a thread to be finished and release associated resources to the thread handle.
Definition: thread.c:486
void opj_mutex_lock(opj_mutex_t *mutex)
Lock/acquire the mutex.
Definition: thread.c:443
void opj_thread_pool_destroy(opj_thread_pool_t *tp)
Destroy a thread pool.
Definition: thread.c:912