<trclass="memdesc:ga29120af1ce48d5ecd651795f2e427755"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Opaque type for a mutex. <ahref="#ga29120af1ce48d5ecd651795f2e427755">More...</a><br/></td></tr>
<trclass="memdesc:gaa81ea27e801a8c0cf453b256ab38e067"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a mutex. <ahref="#gaa81ea27e801a8c0cf453b256ab38e067">More...</a><br/></td></tr>
<trclass="memdesc:gab38a90b92a1d294f7e1886e36a405518"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Lock/acquire the mutex. <ahref="#gab38a90b92a1d294f7e1886e36a405518">More...</a><br/></td></tr>
<trclass="memdesc:gacf1f5a5f7f7257663505af02b717272c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Unlock/release the mutex. <ahref="#gacf1f5a5f7f7257663505af02b717272c">More...</a><br/></td></tr>
<trclass="memdesc:ga66757c34c788b873ad9acfb60a5e008b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Destroy a mutex. <ahref="#ga66757c34c788b873ad9acfb60a5e008b">More...</a><br/></td></tr>
<trclass="memdesc:ga439cd27c17f11fc56a911a126811fb87"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Opaque type for a condition. <ahref="#ga439cd27c17f11fc56a911a126811fb87">More...</a><br/></td></tr>
<trclass="memdesc:ga7f8a4c1ce6d9ad2dde1d293fad317522"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a condition. <ahref="#ga7f8a4c1ce6d9ad2dde1d293fad317522">More...</a><br/></td></tr>
<trclass="memdesc:ga6edf64f08cd0b48299800852d52245d6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Wait for the condition to be signaled. <ahref="#ga6edf64f08cd0b48299800852d52245d6">More...</a><br/></td></tr>
<trclass="memdesc:ga0f3687b35d6f3c395e1156a8499d1632"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Signal waiting threads on a condition. <ahref="#ga0f3687b35d6f3c395e1156a8499d1632">More...</a><br/></td></tr>
<trclass="memdesc:gafba4c2356f6d070d43e5f0d5c71fdbee"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Destroy a condition. <ahref="#gafba4c2356f6d070d43e5f0d5c71fdbee">More...</a><br/></td></tr>
<trclass="memdesc:gaed72b7b75acb6eaeb620085b01ee365b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Opaque type for a thread handle. <ahref="#gaed72b7b75acb6eaeb620085b01ee365b">More...</a><br/></td></tr>
<trclass="memdesc:gae5f9aa8219645e0e836aaf0c453db624"><tdclass="mdescLeft"> </td><tdclass="mdescRight">User function to execute in a thread. <ahref="#gae5f9aa8219645e0e836aaf0c453db624">More...</a><br/></td></tr>
<trclass="memdesc:ga541be683ba651c8244bde3f0d3650c92"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a new thread. <ahref="#ga541be683ba651c8244bde3f0d3650c92">More...</a><br/></td></tr>
<trclass="memdesc:gad49986b56da75f8609b7c940c17f713f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Wait for a thread to be finished and release associated resources to the thread handle. <ahref="#gad49986b56da75f8609b7c940c17f713f">More...</a><br/></td></tr>
<trclass="memdesc:ga9395f97b1e62916dc8b5d2ea4749f74a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Opaque type for a thread local storage. <ahref="#ga9395f97b1e62916dc8b5d2ea4749f74a">More...</a><br/></td></tr>
<trclass="memdesc:ga38f8cdfd288c8ff8963444403549ad6c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Type of the function used to free a TLS value. <ahref="#ga38f8cdfd288c8ff8963444403549ad6c">More...</a><br/></td></tr>
<trclass="memitem:ga90caa0ff9c1e54033ef1e3010faf03a9"><tdclass="memItemLeft"align="right"valign="top">void * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___t_h_r_e_a_d.html#ga90caa0ff9c1e54033ef1e3010faf03a9">opj_tls_get</a> (<aclass="el"href="structopj__tls__t.html">opj_tls_t</a> *tls, int key)</td></tr>
<trclass="memdesc:ga90caa0ff9c1e54033ef1e3010faf03a9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get a thread local value corresponding to the provided key. <ahref="#ga90caa0ff9c1e54033ef1e3010faf03a9">More...</a><br/></td></tr>
<trclass="memitem:gab1b97098aabc89f98eca8f8f7274f3e7"><tdclass="memItemLeft"align="right"valign="top"><aclass="el"href="openjpeg_8h.html#abb5dad6294f4611f1925388e919b16f4">OPJ_BOOL</a> </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___t_h_r_e_a_d.html#gab1b97098aabc89f98eca8f8f7274f3e7">opj_tls_set</a> (<aclass="el"href="structopj__tls__t.html">opj_tls_t</a> *tls, int key, void *value, <aclass="el"href="group___t_h_r_e_a_d.html#ga38f8cdfd288c8ff8963444403549ad6c">opj_tls_free_func</a> free_func)</td></tr>
<trclass="memdesc:gab1b97098aabc89f98eca8f8f7274f3e7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Set a thread local value corresponding to the provided key. <ahref="#gab1b97098aabc89f98eca8f8f7274f3e7">More...</a><br/></td></tr>
<trclass="memdesc:ga656a5e32341e7433cf6b70e53b002c5e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Opaque type for a thread pool. <ahref="#ga656a5e32341e7433cf6b70e53b002c5e">More...</a><br/></td></tr>
<trclass="memdesc:gaf29983f3245378c30edbef61fe22913b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">User function to execute in a thread. <ahref="#gaf29983f3245378c30edbef61fe22913b">More...</a><br/></td></tr>
<trclass="memdesc:ga24a3a1b343df1168a3beb57babfa0916"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create a new thread pool. <ahref="#ga24a3a1b343df1168a3beb57babfa0916">More...</a><br/></td></tr>
<trclass="memdesc:gaf389ecb3a583a30077fc546eef767c89"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Submit a new job to be run by one of the thread in the thread pool. <ahref="#gaf389ecb3a583a30077fc546eef767c89">More...</a><br/></td></tr>
<trclass="memitem:ga0ced26c80598e49bf3a964bb802130f1"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion</a> (<aclass="el"href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *tp, int max_remaining_jobs)</td></tr>
<trclass="memdesc:ga0ced26c80598e49bf3a964bb802130f1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Wait that no more than max_remaining_jobs jobs are remaining in the queue of the thread pool. <ahref="#ga0ced26c80598e49bf3a964bb802130f1">More...</a><br/></td></tr>
<trclass="memdesc:ga4faef98a6b8495c63e9e5ce9cf0c3fc3"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Return the number of threads associated with the thread pool. <ahref="#ga4faef98a6b8495c63e9e5ce9cf0c3fc3">More...</a><br/></td></tr>
<trclass="memdesc:gae44e8b9258d0baa19e3671a382faa33e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Destroy a thread pool. <ahref="#gae44e8b9258d0baa19e3671a382faa33e">More...</a><br/></td></tr>
<tr><tdclass="paramname">user_data</td><td>user data provided with <aclass="el"href="group___t_h_r_e_a_d.html#ga541be683ba651c8244bde3f0d3650c92"title="Creates a new thread. ">opj_thread_create()</a></td></tr>
<tr><tdclass="paramname">tls</td><td>handle to thread local storage </td></tr>
<tr><tdclass="paramname">user_data</td><td>user data provided with <aclass="el"href="group___t_h_r_e_a_d.html#ga541be683ba651c8244bde3f0d3650c92"title="Creates a new thread. ">opj_thread_create()</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>the condition or NULL in case of error (can for example happen if the library is built without thread support) </dd></dl>
<p>Referenced by <aclass="el"href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, and <aclass="el"href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
<p>One of the thread waiting with <aclass="el"href="group___t_h_r_e_a_d.html#ga6edf64f08cd0b48299800852d52245d6"title="Wait for the condition to be signaled. ">opj_cond_wait()</a> will be waken up. It is strongly advised that this call is done with the mutex that is used by <aclass="el"href="group___t_h_r_e_a_d.html#ga6edf64f08cd0b48299800852d52245d6"title="Wait for the condition to be signaled. ">opj_cond_wait()</a>, in a acquired state. </p><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">cond</td><td>the condition to signal. </td></tr>
<p>Referenced by <aclass="el"href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, <aclass="el"href="thread_8c.html#a57e6dc05f2283639a2ec0b6884d9691c">opj_thread_pool_get_next_job()</a>, and <aclass="el"href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job()</a>.</p>
<p>The semantics is the same as the POSIX pthread_cond_wait. The provided mutex <em>must</em> be acquired before calling this function, and released afterwards. The mutex will be released by this function while it must wait for the condition and reacquired afterwards. In some particular situations, the function might return even if the condition is not signaled with <aclass="el"href="group___t_h_r_e_a_d.html#ga0f3687b35d6f3c395e1156a8499d1632"title="Signal waiting threads on a condition. ">opj_cond_signal()</a>, hence the need to check with an application level mechanism.</p>
<p>Referenced by <aclass="el"href="thread_8c.html#a57e6dc05f2283639a2ec0b6884d9691c">opj_thread_pool_get_next_job()</a>, <aclass="el"href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>, <aclass="el"href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job()</a>, and <aclass="el"href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion()</a>.</p>
<dlclass="section return"><dt>Returns</dt><dd>the mutex or NULL in case of error (can for example happen if the library is built without thread support) </dd></dl>
<p>Referenced by <aclass="el"href="group___t1.html#gaa892d07bb383a4dafa51506cf23740a4">opj_t1_encode_cblks()</a>, <aclass="el"href="tcd_8c.html#a61608d1a920574e556d417a4b0e23a3a">opj_tcd_t1_decode()</a>, <aclass="el"href="group___t_h_r_e_a_d.html#ga24a3a1b343df1168a3beb57babfa0916">opj_thread_pool_create()</a>, and <aclass="el"href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
<p>Referenced by <aclass="el"href="group___t1.html#gaa892d07bb383a4dafa51506cf23740a4">opj_t1_encode_cblks()</a>, <aclass="el"href="tcd_8c.html#a61608d1a920574e556d417a4b0e23a3a">opj_tcd_t1_decode()</a>, <aclass="el"href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, and <aclass="el"href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
<tr><tdclass="paramname">thread_fn</td><td>Function to run in the new thread. </td></tr>
<tr><tdclass="paramname">user_data</td><td>user data provided to the thread function. Might be NULL. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>a thread handle or NULL in case of failure (can for example happen if the library is built without thread support) </dd></dl>
<p>num_thread must nominally be >= 1 to create a real thread pool. If num_threads is negative or null, then a dummy thread pool will be created. All functions operating on the thread pool will work, but job submission will be run synchronously in the calling thread.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">num_threads</td><td>the number of threads to allocate for this thread pool. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>a thread pool handle, or NULL in case of failure (can for example happen if the library is built without thread support) </dd></dl>
<p>Referenced by <aclass="el"href="bench__dwt_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main()</a>, <aclass="el"href="group___j2_k.html#gad3c2b25f4d5a5f6fd4b442bc7210f6da">opj_j2k_create_compress()</a>, <aclass="el"href="j2k_8h.html#ad76bb79d4d63030222ebf3dbe3fe86cf">opj_j2k_create_decompress()</a>, and <aclass="el"href="group___j2_k.html#gabecf91393e6703f8be5006b19df1be22">opj_j2k_set_threads()</a>.</p>
<p>Referenced by <aclass="el"href="bench__dwt_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main()</a>, <aclass="el"href="j2k_8h.html#a5c4508543b134e726107308b6463528e">opj_j2k_destroy()</a>, <aclass="el"href="group___j2_k.html#gabecf91393e6703f8be5006b19df1be22">opj_j2k_set_threads()</a>, and <aclass="el"href="group___t_h_r_e_a_d.html#ga24a3a1b343df1168a3beb57babfa0916">opj_thread_pool_create()</a>.</p>
<p>Referenced by <aclass="el"href="group___d_w_t.html#ga473550255363b8acb0c9b10a6dbac434">opj_dwt_decode_tile()</a>, <aclass="el"href="dwt_8c.html#af833f69ca2dd4480b97b2afd7ea0322b">opj_dwt_decode_tile_97()</a>, <aclass="el"href="group___d_w_t.html#gaaae701033c6732995e99ce22d8bffba8">opj_dwt_encode_procedure()</a>, and <aclass="el"href="group___t1.html#ga5df121baefa4293a2c0d0122694e0902">opj_t1_decode_cblks()</a>.</p>
<p>Submit a new job to be run by one of the thread in the thread pool. </p>
<p>The job ( thread_fn, user_data ) will be added in the queue of jobs managed by the thread pool, and run by the first thread that is no longer busy.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">tp</td><td>the thread pool handle. </td></tr>
<tr><tdclass="paramname">job_fn</td><td>Function to run. Must not be NULL. </td></tr>
<tr><tdclass="paramname">user_data</td><td>User data provided to thread_fn. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>OPJ_TRUE if the job was successfully submitted. </dd></dl>
<p>Referenced by <aclass="el"href="group___d_w_t.html#ga473550255363b8acb0c9b10a6dbac434">opj_dwt_decode_tile()</a>, <aclass="el"href="dwt_8c.html#af833f69ca2dd4480b97b2afd7ea0322b">opj_dwt_decode_tile_97()</a>, <aclass="el"href="group___d_w_t.html#gaaae701033c6732995e99ce22d8bffba8">opj_dwt_encode_procedure()</a>, <aclass="el"href="group___t1.html#ga5df121baefa4293a2c0d0122694e0902">opj_t1_decode_cblks()</a>, and <aclass="el"href="group___t1.html#gaa892d07bb383a4dafa51506cf23740a4">opj_t1_encode_cblks()</a>.</p>
<p>Wait that no more than max_remaining_jobs jobs are remaining in the queue of the thread pool. </p>
<p>The aim of this function is to avoid submitting too many jobs while the thread pool cannot cope fast enough with them, which would result potentially in out-of-memory situations with too many job descriptions being queued.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">tp</td><td>the thread pool handle </td></tr>
<tr><tdclass="paramname">max_remaining_jobs</td><td>maximum number of jobs allowed to be queued without waiting. </td></tr>
<p>Referenced by <aclass="el"href="group___d_w_t.html#ga473550255363b8acb0c9b10a6dbac434">opj_dwt_decode_tile()</a>, <aclass="el"href="dwt_8c.html#af833f69ca2dd4480b97b2afd7ea0322b">opj_dwt_decode_tile_97()</a>, <aclass="el"href="group___d_w_t.html#gaaae701033c6732995e99ce22d8bffba8">opj_dwt_encode_procedure()</a>, <aclass="el"href="group___t1.html#gaa892d07bb383a4dafa51506cf23740a4">opj_t1_encode_cblks()</a>, <aclass="el"href="tcd_8c.html#a61608d1a920574e556d417a4b0e23a3a">opj_tcd_t1_decode()</a>, and <aclass="el"href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>.</p>
<p>Referenced by <aclass="el"href="t1_8c.html#a3a260db0855d38ed19c060139365b1ad">opj_t1_cblk_encode_processor()</a>, and <aclass="el"href="t1_8c.html#a4f37cf7aca8eb1313fe5bc320c85ad55">opj_t1_clbl_decode_processor()</a>.</p>
<p>Referenced by <aclass="el"href="t1_8c.html#a3a260db0855d38ed19c060139365b1ad">opj_t1_cblk_encode_processor()</a>, and <aclass="el"href="t1_8c.html#a4f37cf7aca8eb1313fe5bc320c85ad55">opj_t1_clbl_decode_processor()</a>.</p>