Update Doxygen doc
[openjpeg.git] / doxygen / group___t_h_r_e_a_d.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.10"/>
7 <title>OpenJPEG: THREAD - Mutex, conditions, threads and thread pools</title>
8 <link href="tabs.css" rel="stylesheet" type="text/css"/>
9 <script type="text/javascript" src="jquery.js"></script>
10 <script type="text/javascript" src="dynsections.js"></script>
11 <link href="doxygen.css" rel="stylesheet" type="text/css" />
12 </head>
13 <body>
14 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
15 <div id="titlearea">
16 <table cellspacing="0" cellpadding="0">
17  <tbody>
18  <tr style="height: 56px;">
19   <td id="projectalign" style="padding-left: 0.5em;">
20    <div id="projectname">OpenJPEG
21    &#160;<span id="projectnumber">2.2.0</span>
22    </div>
23   </td>
24  </tr>
25  </tbody>
26 </table>
27 </div>
28 <!-- end header part -->
29 <!-- Generated by Doxygen 1.8.10 -->
30   <div id="navrow1" class="tabs">
31     <ul class="tablist">
32       <li><a href="index.html"><span>Main&#160;Page</span></a></li>
33       <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
34       <li><a href="modules.html"><span>Modules</span></a></li>
35       <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
36       <li><a href="files.html"><span>Files</span></a></li>
37     </ul>
38   </div>
39 </div><!-- top -->
40 <div class="header">
41   <div class="headertitle">
42 <div class="title">THREAD - Mutex, conditions, threads and thread pools</div>  </div>
43 </div><!--header-->
44 <div class="contents">
45 <table class="memberdecls">
46 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
47 Mutex</h2></td></tr>
48 <tr class="memitem:ga29120af1ce48d5ecd651795f2e427755"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a></td></tr>
49 <tr class="memdesc:ga29120af1ce48d5ecd651795f2e427755"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opaque type for a mutex.  <a href="#ga29120af1ce48d5ecd651795f2e427755">More...</a><br /></td></tr>
50 <tr class="separator:ga29120af1ce48d5ecd651795f2e427755"><td class="memSeparator" colspan="2">&#160;</td></tr>
51 <tr class="memitem:gaa81ea27e801a8c0cf453b256ab38e067"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gaa81ea27e801a8c0cf453b256ab38e067">opj_mutex_create</a> (void)</td></tr>
52 <tr class="memdesc:gaa81ea27e801a8c0cf453b256ab38e067"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a mutex.  <a href="#gaa81ea27e801a8c0cf453b256ab38e067">More...</a><br /></td></tr>
53 <tr class="separator:gaa81ea27e801a8c0cf453b256ab38e067"><td class="memSeparator" colspan="2">&#160;</td></tr>
54 <tr class="memitem:gab38a90b92a1d294f7e1886e36a405518"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gab38a90b92a1d294f7e1886e36a405518">opj_mutex_lock</a> (<a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *mutex)</td></tr>
55 <tr class="memdesc:gab38a90b92a1d294f7e1886e36a405518"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lock/acquire the mutex.  <a href="#gab38a90b92a1d294f7e1886e36a405518">More...</a><br /></td></tr>
56 <tr class="separator:gab38a90b92a1d294f7e1886e36a405518"><td class="memSeparator" colspan="2">&#160;</td></tr>
57 <tr class="memitem:gacf1f5a5f7f7257663505af02b717272c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gacf1f5a5f7f7257663505af02b717272c">opj_mutex_unlock</a> (<a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *mutex)</td></tr>
58 <tr class="memdesc:gacf1f5a5f7f7257663505af02b717272c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unlock/release the mutex.  <a href="#gacf1f5a5f7f7257663505af02b717272c">More...</a><br /></td></tr>
59 <tr class="separator:gacf1f5a5f7f7257663505af02b717272c"><td class="memSeparator" colspan="2">&#160;</td></tr>
60 <tr class="memitem:ga66757c34c788b873ad9acfb60a5e008b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga66757c34c788b873ad9acfb60a5e008b">opj_mutex_destroy</a> (<a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *mutex)</td></tr>
61 <tr class="memdesc:ga66757c34c788b873ad9acfb60a5e008b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a mutex.  <a href="#ga66757c34c788b873ad9acfb60a5e008b">More...</a><br /></td></tr>
62 <tr class="separator:ga66757c34c788b873ad9acfb60a5e008b"><td class="memSeparator" colspan="2">&#160;</td></tr>
63 </table><table class="memberdecls">
64 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
65 Condition</h2></td></tr>
66 <tr class="memitem:ga439cd27c17f11fc56a911a126811fb87"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a></td></tr>
67 <tr class="memdesc:ga439cd27c17f11fc56a911a126811fb87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opaque type for a condition.  <a href="#ga439cd27c17f11fc56a911a126811fb87">More...</a><br /></td></tr>
68 <tr class="separator:ga439cd27c17f11fc56a911a126811fb87"><td class="memSeparator" colspan="2">&#160;</td></tr>
69 <tr class="memitem:ga7f8a4c1ce6d9ad2dde1d293fad317522"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga7f8a4c1ce6d9ad2dde1d293fad317522">opj_cond_create</a> (void)</td></tr>
70 <tr class="memdesc:ga7f8a4c1ce6d9ad2dde1d293fad317522"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a condition.  <a href="#ga7f8a4c1ce6d9ad2dde1d293fad317522">More...</a><br /></td></tr>
71 <tr class="separator:ga7f8a4c1ce6d9ad2dde1d293fad317522"><td class="memSeparator" colspan="2">&#160;</td></tr>
72 <tr class="memitem:ga6edf64f08cd0b48299800852d52245d6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga6edf64f08cd0b48299800852d52245d6">opj_cond_wait</a> (<a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *cond, <a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *mutex)</td></tr>
73 <tr class="memdesc:ga6edf64f08cd0b48299800852d52245d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait for the condition to be signaled.  <a href="#ga6edf64f08cd0b48299800852d52245d6">More...</a><br /></td></tr>
74 <tr class="separator:ga6edf64f08cd0b48299800852d52245d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
75 <tr class="memitem:ga0f3687b35d6f3c395e1156a8499d1632"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga0f3687b35d6f3c395e1156a8499d1632">opj_cond_signal</a> (<a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *cond)</td></tr>
76 <tr class="memdesc:ga0f3687b35d6f3c395e1156a8499d1632"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signal waiting threads on a condition.  <a href="#ga0f3687b35d6f3c395e1156a8499d1632">More...</a><br /></td></tr>
77 <tr class="separator:ga0f3687b35d6f3c395e1156a8499d1632"><td class="memSeparator" colspan="2">&#160;</td></tr>
78 <tr class="memitem:gafba4c2356f6d070d43e5f0d5c71fdbee"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gafba4c2356f6d070d43e5f0d5c71fdbee">opj_cond_destroy</a> (<a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *cond)</td></tr>
79 <tr class="memdesc:gafba4c2356f6d070d43e5f0d5c71fdbee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a condition.  <a href="#gafba4c2356f6d070d43e5f0d5c71fdbee">More...</a><br /></td></tr>
80 <tr class="separator:gafba4c2356f6d070d43e5f0d5c71fdbee"><td class="memSeparator" colspan="2">&#160;</td></tr>
81 </table><table class="memberdecls">
82 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
83 Thread</h2></td></tr>
84 <tr class="memitem:gaed72b7b75acb6eaeb620085b01ee365b"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a></td></tr>
85 <tr class="memdesc:gaed72b7b75acb6eaeb620085b01ee365b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opaque type for a thread handle.  <a href="#gaed72b7b75acb6eaeb620085b01ee365b">More...</a><br /></td></tr>
86 <tr class="separator:gaed72b7b75acb6eaeb620085b01ee365b"><td class="memSeparator" colspan="2">&#160;</td></tr>
87 <tr class="memitem:gae5f9aa8219645e0e836aaf0c453db624"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gae5f9aa8219645e0e836aaf0c453db624">opj_thread_fn</a>) (void *user_data)</td></tr>
88 <tr class="memdesc:gae5f9aa8219645e0e836aaf0c453db624"><td class="mdescLeft">&#160;</td><td class="mdescRight">User function to execute in a thread.  <a href="#gae5f9aa8219645e0e836aaf0c453db624">More...</a><br /></td></tr>
89 <tr class="separator:gae5f9aa8219645e0e836aaf0c453db624"><td class="memSeparator" colspan="2">&#160;</td></tr>
90 <tr class="memitem:ga541be683ba651c8244bde3f0d3650c92"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga541be683ba651c8244bde3f0d3650c92">opj_thread_create</a> (<a class="el" href="group___t_h_r_e_a_d.html#gae5f9aa8219645e0e836aaf0c453db624">opj_thread_fn</a> thread_fn, void *user_data)</td></tr>
91 <tr class="memdesc:ga541be683ba651c8244bde3f0d3650c92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new thread.  <a href="#ga541be683ba651c8244bde3f0d3650c92">More...</a><br /></td></tr>
92 <tr class="separator:ga541be683ba651c8244bde3f0d3650c92"><td class="memSeparator" colspan="2">&#160;</td></tr>
93 <tr class="memitem:gad49986b56da75f8609b7c940c17f713f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gad49986b56da75f8609b7c940c17f713f">opj_thread_join</a> (<a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a> *thread)</td></tr>
94 <tr class="memdesc:gad49986b56da75f8609b7c940c17f713f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait for a thread to be finished and release associated resources to the thread handle.  <a href="#gad49986b56da75f8609b7c940c17f713f">More...</a><br /></td></tr>
95 <tr class="separator:gad49986b56da75f8609b7c940c17f713f"><td class="memSeparator" colspan="2">&#160;</td></tr>
96 </table><table class="memberdecls">
97 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
98 Thread local storage</h2></td></tr>
99 <tr class="memitem:ga9395f97b1e62916dc8b5d2ea4749f74a"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structopj__tls__t.html">opj_tls_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga9395f97b1e62916dc8b5d2ea4749f74a">opj_tls_t</a></td></tr>
100 <tr class="memdesc:ga9395f97b1e62916dc8b5d2ea4749f74a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opaque type for a thread local storage.  <a href="#ga9395f97b1e62916dc8b5d2ea4749f74a">More...</a><br /></td></tr>
101 <tr class="separator:ga9395f97b1e62916dc8b5d2ea4749f74a"><td class="memSeparator" colspan="2">&#160;</td></tr>
102 <tr class="memitem:ga38f8cdfd288c8ff8963444403549ad6c"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga38f8cdfd288c8ff8963444403549ad6c">opj_tls_free_func</a>) (void *value)</td></tr>
103 <tr class="memdesc:ga38f8cdfd288c8ff8963444403549ad6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Type of the function used to free a TLS value.  <a href="#ga38f8cdfd288c8ff8963444403549ad6c">More...</a><br /></td></tr>
104 <tr class="separator:ga38f8cdfd288c8ff8963444403549ad6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
105 <tr class="memitem:ga90caa0ff9c1e54033ef1e3010faf03a9"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga90caa0ff9c1e54033ef1e3010faf03a9">opj_tls_get</a> (<a class="el" href="structopj__tls__t.html">opj_tls_t</a> *tls, int key)</td></tr>
106 <tr class="memdesc:ga90caa0ff9c1e54033ef1e3010faf03a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a thread local value corresponding to the provided key.  <a href="#ga90caa0ff9c1e54033ef1e3010faf03a9">More...</a><br /></td></tr>
107 <tr class="separator:ga90caa0ff9c1e54033ef1e3010faf03a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
108 <tr class="memitem:gab1b97098aabc89f98eca8f8f7274f3e7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="openjpeg_8h.html#abb5dad6294f4611f1925388e919b16f4">OPJ_BOOL</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gab1b97098aabc89f98eca8f8f7274f3e7">opj_tls_set</a> (<a class="el" href="structopj__tls__t.html">opj_tls_t</a> *tls, int key, void *value, <a class="el" href="group___t_h_r_e_a_d.html#ga38f8cdfd288c8ff8963444403549ad6c">opj_tls_free_func</a> free_func)</td></tr>
109 <tr class="memdesc:gab1b97098aabc89f98eca8f8f7274f3e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a thread local value corresponding to the provided key.  <a href="#gab1b97098aabc89f98eca8f8f7274f3e7">More...</a><br /></td></tr>
110 <tr class="separator:gab1b97098aabc89f98eca8f8f7274f3e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
111 </table><table class="memberdecls">
112 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
113 Thread pool</h2></td></tr>
114 <tr class="memitem:ga656a5e32341e7433cf6b70e53b002c5e"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga656a5e32341e7433cf6b70e53b002c5e">opj_thread_pool_t</a></td></tr>
115 <tr class="memdesc:ga656a5e32341e7433cf6b70e53b002c5e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opaque type for a thread pool.  <a href="#ga656a5e32341e7433cf6b70e53b002c5e">More...</a><br /></td></tr>
116 <tr class="separator:ga656a5e32341e7433cf6b70e53b002c5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
117 <tr class="memitem:gaf29983f3245378c30edbef61fe22913b"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gaf29983f3245378c30edbef61fe22913b">opj_job_fn</a>) (void *user_data, <a class="el" href="structopj__tls__t.html">opj_tls_t</a> *tls)</td></tr>
118 <tr class="memdesc:gaf29983f3245378c30edbef61fe22913b"><td class="mdescLeft">&#160;</td><td class="mdescRight">User function to execute in a thread.  <a href="#gaf29983f3245378c30edbef61fe22913b">More...</a><br /></td></tr>
119 <tr class="separator:gaf29983f3245378c30edbef61fe22913b"><td class="memSeparator" colspan="2">&#160;</td></tr>
120 <tr class="memitem:ga24a3a1b343df1168a3beb57babfa0916"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga24a3a1b343df1168a3beb57babfa0916">opj_thread_pool_create</a> (int num_threads)</td></tr>
121 <tr class="memdesc:ga24a3a1b343df1168a3beb57babfa0916"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new thread pool.  <a href="#ga24a3a1b343df1168a3beb57babfa0916">More...</a><br /></td></tr>
122 <tr class="separator:ga24a3a1b343df1168a3beb57babfa0916"><td class="memSeparator" colspan="2">&#160;</td></tr>
123 <tr class="memitem:gaf389ecb3a583a30077fc546eef767c89"><td class="memItemLeft" align="right" valign="top"><a class="el" href="openjpeg_8h.html#abb5dad6294f4611f1925388e919b16f4">OPJ_BOOL</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job</a> (<a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *tp, <a class="el" href="group___t_h_r_e_a_d.html#gaf29983f3245378c30edbef61fe22913b">opj_job_fn</a> job_fn, void *user_data)</td></tr>
124 <tr class="memdesc:gaf389ecb3a583a30077fc546eef767c89"><td class="mdescLeft">&#160;</td><td class="mdescRight">Submit a new job to be run by one of the thread in the thread pool.  <a href="#gaf389ecb3a583a30077fc546eef767c89">More...</a><br /></td></tr>
125 <tr class="separator:gaf389ecb3a583a30077fc546eef767c89"><td class="memSeparator" colspan="2">&#160;</td></tr>
126 <tr class="memitem:ga0ced26c80598e49bf3a964bb802130f1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion</a> (<a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *tp, int max_remaining_jobs)</td></tr>
127 <tr class="memdesc:ga0ced26c80598e49bf3a964bb802130f1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait that no more than max_remaining_jobs jobs are remaining in the queue of the thread pool.  <a href="#ga0ced26c80598e49bf3a964bb802130f1">More...</a><br /></td></tr>
128 <tr class="separator:ga0ced26c80598e49bf3a964bb802130f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
129 <tr class="memitem:ga4faef98a6b8495c63e9e5ce9cf0c3fc3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#ga4faef98a6b8495c63e9e5ce9cf0c3fc3">opj_thread_pool_get_thread_count</a> (<a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *tp)</td></tr>
130 <tr class="memdesc:ga4faef98a6b8495c63e9e5ce9cf0c3fc3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the number of threads associated with the thread pool.  <a href="#ga4faef98a6b8495c63e9e5ce9cf0c3fc3">More...</a><br /></td></tr>
131 <tr class="separator:ga4faef98a6b8495c63e9e5ce9cf0c3fc3"><td class="memSeparator" colspan="2">&#160;</td></tr>
132 <tr class="memitem:gae44e8b9258d0baa19e3671a382faa33e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy</a> (<a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *tp)</td></tr>
133 <tr class="memdesc:gae44e8b9258d0baa19e3671a382faa33e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a thread pool.  <a href="#gae44e8b9258d0baa19e3671a382faa33e">More...</a><br /></td></tr>
134 <tr class="separator:gae44e8b9258d0baa19e3671a382faa33e"><td class="memSeparator" colspan="2">&#160;</td></tr>
135 </table>
136 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
137 <h2 class="groupheader">Typedef Documentation</h2>
138 <a class="anchor" id="ga439cd27c17f11fc56a911a126811fb87"></a>
139 <div class="memitem">
140 <div class="memproto">
141       <table class="memname">
142         <tr>
143           <td class="memname">typedef struct <a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> <a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a></td>
144         </tr>
145       </table>
146 </div><div class="memdoc">
147
148 <p>Opaque type for a condition. </p>
149
150 </div>
151 </div>
152 <a class="anchor" id="gaf29983f3245378c30edbef61fe22913b"></a>
153 <div class="memitem">
154 <div class="memproto">
155       <table class="memname">
156         <tr>
157           <td class="memname">typedef void(* opj_job_fn) (void *user_data, <a class="el" href="structopj__tls__t.html">opj_tls_t</a> *tls)</td>
158         </tr>
159       </table>
160 </div><div class="memdoc">
161
162 <p>User function to execute in a thread. </p>
163 <dl class="params"><dt>Parameters</dt><dd>
164   <table class="params">
165     <tr><td class="paramname">user_data</td><td>user data provided with <a class="el" href="group___t_h_r_e_a_d.html#ga541be683ba651c8244bde3f0d3650c92" title="Creates a new thread. ">opj_thread_create()</a> </td></tr>
166     <tr><td class="paramname">tls</td><td>handle to thread local storage </td></tr>
167   </table>
168   </dd>
169 </dl>
170
171 </div>
172 </div>
173 <a class="anchor" id="ga29120af1ce48d5ecd651795f2e427755"></a>
174 <div class="memitem">
175 <div class="memproto">
176       <table class="memname">
177         <tr>
178           <td class="memname">typedef struct <a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> <a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a></td>
179         </tr>
180       </table>
181 </div><div class="memdoc">
182
183 <p>Opaque type for a mutex. </p>
184
185 </div>
186 </div>
187 <a class="anchor" id="gae5f9aa8219645e0e836aaf0c453db624"></a>
188 <div class="memitem">
189 <div class="memproto">
190       <table class="memname">
191         <tr>
192           <td class="memname">typedef void(* opj_thread_fn) (void *user_data)</td>
193         </tr>
194       </table>
195 </div><div class="memdoc">
196
197 <p>User function to execute in a thread. </p>
198 <dl class="params"><dt>Parameters</dt><dd>
199   <table class="params">
200     <tr><td class="paramname">user_data</td><td>user data provided with <a class="el" href="group___t_h_r_e_a_d.html#ga541be683ba651c8244bde3f0d3650c92" title="Creates a new thread. ">opj_thread_create()</a> </td></tr>
201   </table>
202   </dd>
203 </dl>
204
205 </div>
206 </div>
207 <a class="anchor" id="ga656a5e32341e7433cf6b70e53b002c5e"></a>
208 <div class="memitem">
209 <div class="memproto">
210       <table class="memname">
211         <tr>
212           <td class="memname">typedef struct <a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> <a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a></td>
213         </tr>
214       </table>
215 </div><div class="memdoc">
216
217 <p>Opaque type for a thread pool. </p>
218
219 </div>
220 </div>
221 <a class="anchor" id="gaed72b7b75acb6eaeb620085b01ee365b"></a>
222 <div class="memitem">
223 <div class="memproto">
224       <table class="memname">
225         <tr>
226           <td class="memname">typedef struct <a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a> <a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a></td>
227         </tr>
228       </table>
229 </div><div class="memdoc">
230
231 <p>Opaque type for a thread handle. </p>
232
233 </div>
234 </div>
235 <a class="anchor" id="ga38f8cdfd288c8ff8963444403549ad6c"></a>
236 <div class="memitem">
237 <div class="memproto">
238       <table class="memname">
239         <tr>
240           <td class="memname">typedef void(* opj_tls_free_func) (void *value)</td>
241         </tr>
242       </table>
243 </div><div class="memdoc">
244
245 <p>Type of the function used to free a TLS value. </p>
246
247 </div>
248 </div>
249 <a class="anchor" id="ga9395f97b1e62916dc8b5d2ea4749f74a"></a>
250 <div class="memitem">
251 <div class="memproto">
252       <table class="memname">
253         <tr>
254           <td class="memname">typedef struct <a class="el" href="structopj__tls__t.html">opj_tls_t</a> <a class="el" href="structopj__tls__t.html">opj_tls_t</a></td>
255         </tr>
256       </table>
257 </div><div class="memdoc">
258
259 <p>Opaque type for a thread local storage. </p>
260
261 </div>
262 </div>
263 <h2 class="groupheader">Function Documentation</h2>
264 <a class="anchor" id="ga7f8a4c1ce6d9ad2dde1d293fad317522"></a>
265 <div class="memitem">
266 <div class="memproto">
267       <table class="memname">
268         <tr>
269           <td class="memname"><a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a>* opj_cond_create </td>
270           <td>(</td>
271           <td class="paramtype">void&#160;</td>
272           <td class="paramname"></td><td>)</td>
273           <td></td>
274         </tr>
275       </table>
276 </div><div class="memdoc">
277
278 <p>Creates a condition. </p>
279 <dl class="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>
280
281 <p>Referenced by <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
282
283 </div>
284 </div>
285 <a class="anchor" id="gafba4c2356f6d070d43e5f0d5c71fdbee"></a>
286 <div class="memitem">
287 <div class="memproto">
288       <table class="memname">
289         <tr>
290           <td class="memname">void opj_cond_destroy </td>
291           <td>(</td>
292           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *&#160;</td>
293           <td class="paramname"><em>cond</em></td><td>)</td>
294           <td></td>
295         </tr>
296       </table>
297 </div><div class="memdoc">
298
299 <p>Destroy a condition. </p>
300 <dl class="params"><dt>Parameters</dt><dd>
301   <table class="params">
302     <tr><td class="paramname">cond</td><td>the condition to destroy. </td></tr>
303   </table>
304   </dd>
305 </dl>
306
307 <p>Referenced by <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>.</p>
308
309 </div>
310 </div>
311 <a class="anchor" id="ga0f3687b35d6f3c395e1156a8499d1632"></a>
312 <div class="memitem">
313 <div class="memproto">
314       <table class="memname">
315         <tr>
316           <td class="memname">void opj_cond_signal </td>
317           <td>(</td>
318           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *&#160;</td>
319           <td class="paramname"><em>cond</em></td><td>)</td>
320           <td></td>
321         </tr>
322       </table>
323 </div><div class="memdoc">
324
325 <p>Signal waiting threads on a condition. </p>
326 <p>One of the thread waiting with <a class="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 <a class="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><dl class="params"><dt>Parameters</dt><dd>
327   <table class="params">
328     <tr><td class="paramname">cond</td><td>the condition to signal. </td></tr>
329   </table>
330   </dd>
331 </dl>
332
333 <p>Referenced by <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, <a class="el" href="thread_8c.html#a57e6dc05f2283639a2ec0b6884d9691c">opj_thread_pool_get_next_job()</a>, and <a class="el" href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job()</a>.</p>
334
335 </div>
336 </div>
337 <a class="anchor" id="ga6edf64f08cd0b48299800852d52245d6"></a>
338 <div class="memitem">
339 <div class="memproto">
340       <table class="memname">
341         <tr>
342           <td class="memname">void opj_cond_wait </td>
343           <td>(</td>
344           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga439cd27c17f11fc56a911a126811fb87">opj_cond_t</a> *&#160;</td>
345           <td class="paramname"><em>cond</em>, </td>
346         </tr>
347         <tr>
348           <td class="paramkey"></td>
349           <td></td>
350           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *&#160;</td>
351           <td class="paramname"><em>mutex</em>&#160;</td>
352         </tr>
353         <tr>
354           <td></td>
355           <td>)</td>
356           <td></td><td></td>
357         </tr>
358       </table>
359 </div><div class="memdoc">
360
361 <p>Wait for the condition to be signaled. </p>
362 <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 <a class="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>
363 <p>Waiting thread : </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;opj_mutex_lock(mutex);</div>
364 <div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;while( !some_application_level_condition )</div>
365 <div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;{</div>
366 <div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;    opj_cond_wait(cond, mutex);</div>
367 <div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;}</div>
368 <div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;opj_mutex_unlock(mutex);</div>
369 </div><!-- fragment --><p>Signaling thread : </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;opj_mutex_lock(mutex);</div>
370 <div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;some_application_level_condition = TRUE;</div>
371 <div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;opj_cond_signal(cond);</div>
372 <div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;opj_mutex_unlock(mutex);</div>
373 </div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
374   <table class="params">
375     <tr><td class="paramname">cond</td><td>the condition to wait. </td></tr>
376     <tr><td class="paramname">mutex</td><td>the mutex (in acquired state before calling this function) </td></tr>
377   </table>
378   </dd>
379 </dl>
380
381 <p>Referenced by <a class="el" href="thread_8c.html#a57e6dc05f2283639a2ec0b6884d9691c">opj_thread_pool_get_next_job()</a>, <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job()</a>, and <a class="el" href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion()</a>.</p>
382
383 </div>
384 </div>
385 <a class="anchor" id="gaa81ea27e801a8c0cf453b256ab38e067"></a>
386 <div class="memitem">
387 <div class="memproto">
388       <table class="memname">
389         <tr>
390           <td class="memname"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a>* opj_mutex_create </td>
391           <td>(</td>
392           <td class="paramtype">void&#160;</td>
393           <td class="paramname"></td><td>)</td>
394           <td></td>
395         </tr>
396       </table>
397 </div><div class="memdoc">
398
399 <p>Creates a mutex. </p>
400 <dl class="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>
401
402 <p>Referenced by <a class="el" href="tcd_8c.html#a61608d1a920574e556d417a4b0e23a3a">opj_tcd_t1_decode()</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga24a3a1b343df1168a3beb57babfa0916">opj_thread_pool_create()</a>, and <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
403
404 </div>
405 </div>
406 <a class="anchor" id="ga66757c34c788b873ad9acfb60a5e008b"></a>
407 <div class="memitem">
408 <div class="memproto">
409       <table class="memname">
410         <tr>
411           <td class="memname">void opj_mutex_destroy </td>
412           <td>(</td>
413           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *&#160;</td>
414           <td class="paramname"><em>mutex</em></td><td>)</td>
415           <td></td>
416         </tr>
417       </table>
418 </div><div class="memdoc">
419
420 <p>Destroy a mutex. </p>
421 <dl class="params"><dt>Parameters</dt><dd>
422   <table class="params">
423     <tr><td class="paramname">mutex</td><td>the mutex to destroy. </td></tr>
424   </table>
425   </dd>
426 </dl>
427
428 <p>Referenced by <a class="el" href="tcd_8c.html#a61608d1a920574e556d417a4b0e23a3a">opj_tcd_t1_decode()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, and <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
429
430 </div>
431 </div>
432 <a class="anchor" id="gab38a90b92a1d294f7e1886e36a405518"></a>
433 <div class="memitem">
434 <div class="memproto">
435       <table class="memname">
436         <tr>
437           <td class="memname">void opj_mutex_lock </td>
438           <td>(</td>
439           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *&#160;</td>
440           <td class="paramname"><em>mutex</em></td><td>)</td>
441           <td></td>
442         </tr>
443       </table>
444 </div><div class="memdoc">
445
446 <p>Lock/acquire the mutex. </p>
447 <dl class="params"><dt>Parameters</dt><dd>
448   <table class="params">
449     <tr><td class="paramname">mutex</td><td>the mutex to acquire. </td></tr>
450   </table>
451   </dd>
452 </dl>
453
454 <p>Referenced by <a class="el" href="group___t1.html#gab90391839b2f56ca40aaae1b8748ca3c">opj_t1_decode_cblk()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, <a class="el" href="thread_8c.html#a57e6dc05f2283639a2ec0b6884d9691c">opj_thread_pool_get_next_job()</a>, <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job()</a>, and <a class="el" href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion()</a>.</p>
455
456 </div>
457 </div>
458 <a class="anchor" id="gacf1f5a5f7f7257663505af02b717272c"></a>
459 <div class="memitem">
460 <div class="memproto">
461       <table class="memname">
462         <tr>
463           <td class="memname">void opj_mutex_unlock </td>
464           <td>(</td>
465           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga29120af1ce48d5ecd651795f2e427755">opj_mutex_t</a> *&#160;</td>
466           <td class="paramname"><em>mutex</em></td><td>)</td>
467           <td></td>
468         </tr>
469       </table>
470 </div><div class="memdoc">
471
472 <p>Unlock/release the mutex. </p>
473 <dl class="params"><dt>Parameters</dt><dd>
474   <table class="params">
475     <tr><td class="paramname">mutex</td><td>the mutex to release. </td></tr>
476   </table>
477   </dd>
478 </dl>
479
480 <p>Referenced by <a class="el" href="group___t1.html#gab90391839b2f56ca40aaae1b8748ca3c">opj_t1_decode_cblk()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, <a class="el" href="thread_8c.html#a57e6dc05f2283639a2ec0b6884d9691c">opj_thread_pool_get_next_job()</a>, <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gaf389ecb3a583a30077fc546eef767c89">opj_thread_pool_submit_job()</a>, and <a class="el" href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion()</a>.</p>
481
482 </div>
483 </div>
484 <a class="anchor" id="ga541be683ba651c8244bde3f0d3650c92"></a>
485 <div class="memitem">
486 <div class="memproto">
487       <table class="memname">
488         <tr>
489           <td class="memname"><a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a>* opj_thread_create </td>
490           <td>(</td>
491           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#gae5f9aa8219645e0e836aaf0c453db624">opj_thread_fn</a>&#160;</td>
492           <td class="paramname"><em>thread_fn</em>, </td>
493         </tr>
494         <tr>
495           <td class="paramkey"></td>
496           <td></td>
497           <td class="paramtype">void *&#160;</td>
498           <td class="paramname"><em>user_data</em>&#160;</td>
499         </tr>
500         <tr>
501           <td></td>
502           <td>)</td>
503           <td></td><td></td>
504         </tr>
505       </table>
506 </div><div class="memdoc">
507
508 <p>Creates a new thread. </p>
509 <dl class="params"><dt>Parameters</dt><dd>
510   <table class="params">
511     <tr><td class="paramname">thread_fn</td><td>Function to run in the new thread. </td></tr>
512     <tr><td class="paramname">user_data</td><td>user data provided to the thread function. Might be NULL. </td></tr>
513   </table>
514   </dd>
515 </dl>
516 <dl class="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>
517
518 <p>Referenced by <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>.</p>
519
520 </div>
521 </div>
522 <a class="anchor" id="gad49986b56da75f8609b7c940c17f713f"></a>
523 <div class="memitem">
524 <div class="memproto">
525       <table class="memname">
526         <tr>
527           <td class="memname">void opj_thread_join </td>
528           <td>(</td>
529           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#gaed72b7b75acb6eaeb620085b01ee365b">opj_thread_t</a> *&#160;</td>
530           <td class="paramname"><em>thread</em></td><td>)</td>
531           <td></td>
532         </tr>
533       </table>
534 </div><div class="memdoc">
535
536 <p>Wait for a thread to be finished and release associated resources to the thread handle. </p>
537 <dl class="params"><dt>Parameters</dt><dd>
538   <table class="params">
539     <tr><td class="paramname">thread</td><td>the thread to wait for being finished. </td></tr>
540   </table>
541   </dd>
542 </dl>
543
544 <p>Referenced by <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>.</p>
545
546 </div>
547 </div>
548 <a class="anchor" id="ga24a3a1b343df1168a3beb57babfa0916"></a>
549 <div class="memitem">
550 <div class="memproto">
551       <table class="memname">
552         <tr>
553           <td class="memname"><a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a>* opj_thread_pool_create </td>
554           <td>(</td>
555           <td class="paramtype">int&#160;</td>
556           <td class="paramname"><em>num_threads</em></td><td>)</td>
557           <td></td>
558         </tr>
559       </table>
560 </div><div class="memdoc">
561
562 <p>Create a new thread pool. </p>
563 <p>num_thread must nominally be &gt;= 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>
564 <dl class="params"><dt>Parameters</dt><dd>
565   <table class="params">
566     <tr><td class="paramname">num_threads</td><td>the number of threads to allocate for this thread pool. </td></tr>
567   </table>
568   </dd>
569 </dl>
570 <dl class="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>
571
572 <p>References <a class="el" href="structopj__thread__pool__t.html#a818a719866334770dda95c675cb73d63">opj_thread_pool_t::mutex</a>, <a class="el" href="group___m_i_s_c.html#ga7fe6dfcb0a623dbec30daf0f48624bf7">opj_calloc()</a>, <a class="el" href="group___m_i_s_c.html#ga2bd00e2482ae36197631bde0665cfdfe">opj_free()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gaa81ea27e801a8c0cf453b256ab38e067">opj_mutex_create()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>, <a class="el" href="thread_8c.html#acdca1ecb372546840fdd9d5d5badce07">opj_thread_pool_setup()</a>, <a class="el" href="thread_8c.html#a28308877c7160bae4a21d2b1c8bddfe0">opj_tls_new()</a>, <a class="el" href="thread_8c.html#a72b07be38efb141bb1f0456227d233e5a837ff250630d32ebcbdec8ab7545cd23">OPJWTS_OK</a>, <a class="el" href="structopj__thread__pool__t.html#a3ee9c2691cf72fb90bf662490830b72b">opj_thread_pool_t::state</a>, and <a class="el" href="structopj__thread__pool__t.html#a401a98b276c965e0b63efaf9e1369730">opj_thread_pool_t::tls</a>.</p>
573
574 <p>Referenced by <a class="el" href="bench__dwt_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main()</a>, <a class="el" href="group___j2_k.html#gad3c2b25f4d5a5f6fd4b442bc7210f6da">opj_j2k_create_compress()</a>, <a class="el" href="j2k_8h.html#ad76bb79d4d63030222ebf3dbe3fe86cf">opj_j2k_create_decompress()</a>, and <a class="el" href="group___j2_k.html#gabecf91393e6703f8be5006b19df1be22">opj_j2k_set_threads()</a>.</p>
575
576 </div>
577 </div>
578 <a class="anchor" id="gae44e8b9258d0baa19e3671a382faa33e"></a>
579 <div class="memitem">
580 <div class="memproto">
581       <table class="memname">
582         <tr>
583           <td class="memname">void opj_thread_pool_destroy </td>
584           <td>(</td>
585           <td class="paramtype"><a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *&#160;</td>
586           <td class="paramname"><em>tp</em></td><td>)</td>
587           <td></td>
588         </tr>
589       </table>
590 </div><div class="memdoc">
591
592 <p>Destroy a thread pool. </p>
593 <dl class="params"><dt>Parameters</dt><dd>
594   <table class="params">
595     <tr><td class="paramname">tp</td><td>the thread pool handle. </td></tr>
596   </table>
597   </dd>
598 </dl>
599
600 <p>References <a class="el" href="structopj__worker__thread__t.html#a8e7cdff9dab59b5be9ed46436437f28a">opj_worker_thread_t::cond</a>, <a class="el" href="structopj__thread__pool__t.html#a19d0f595937228552fe62c69cb2f6c44">opj_thread_pool_t::cond</a>, <a class="el" href="structopj__worker__thread__t.html#a2ba43db98feae7de2aaed97d08ec55ce">opj_worker_thread_t::mutex</a>, <a class="el" href="structopj__thread__pool__t.html#a818a719866334770dda95c675cb73d63">opj_thread_pool_t::mutex</a>, <a class="el" href="structopj__worker__thread__list__t.html#ac0a28fac91ec02c49898229a1122aa67">opj_worker_thread_list_t::next</a>, <a class="el" href="group___t_h_r_e_a_d.html#gafba4c2356f6d070d43e5f0d5c71fdbee">opj_cond_destroy()</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga0f3687b35d6f3c395e1156a8499d1632">opj_cond_signal()</a>, <a class="el" href="group___m_i_s_c.html#ga2bd00e2482ae36197631bde0665cfdfe">opj_free()</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga66757c34c788b873ad9acfb60a5e008b">opj_mutex_destroy()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gab38a90b92a1d294f7e1886e36a405518">opj_mutex_lock()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gacf1f5a5f7f7257663505af02b717272c">opj_mutex_unlock()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gad49986b56da75f8609b7c940c17f713f">opj_thread_join()</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga0ced26c80598e49bf3a964bb802130f1">opj_thread_pool_wait_completion()</a>, <a class="el" href="thread_8c.html#a8f4ee11fc0faa44d49f2c341cbf3dc79">opj_tls_destroy()</a>, <a class="el" href="thread_8c.html#a72b07be38efb141bb1f0456227d233e5a3e1ea93366aedb1abcd0498bf72db68a">OPJWTS_STOP</a>, <a class="el" href="structopj__thread__pool__t.html#a3ee9c2691cf72fb90bf662490830b72b">opj_thread_pool_t::state</a>, <a class="el" href="structopj__worker__thread__t.html#a7ef79b815efbb4ff8d49f3ed4f677073">opj_worker_thread_t::thread</a>, <a class="el" href="structopj__thread__pool__t.html#a401a98b276c965e0b63efaf9e1369730">opj_thread_pool_t::tls</a>, <a class="el" href="structopj__thread__pool__t.html#a50c4caa87ba2a6767d909898cc92b37a">opj_thread_pool_t::waiting_worker_thread_list</a>, <a class="el" href="structopj__thread__pool__t.html#adb012d263904a4f62812ed7d30b0a47e">opj_thread_pool_t::worker_threads</a>, and <a class="el" href="structopj__thread__pool__t.html#a43fd14e3ba8409a0fac589a6dd4e7ee1">opj_thread_pool_t::worker_threads_count</a>.</p>
601
602 <p>Referenced by <a class="el" href="bench__dwt_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main()</a>, <a class="el" href="j2k_8h.html#a5c4508543b134e726107308b6463528e">opj_j2k_destroy()</a>, <a class="el" href="group___j2_k.html#gabecf91393e6703f8be5006b19df1be22">opj_j2k_set_threads()</a>, and <a class="el" href="group___t_h_r_e_a_d.html#ga24a3a1b343df1168a3beb57babfa0916">opj_thread_pool_create()</a>.</p>
603
604 </div>
605 </div>
606 <a class="anchor" id="ga4faef98a6b8495c63e9e5ce9cf0c3fc3"></a>
607 <div class="memitem">
608 <div class="memproto">
609       <table class="memname">
610         <tr>
611           <td class="memname">int opj_thread_pool_get_thread_count </td>
612           <td>(</td>
613           <td class="paramtype"><a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *&#160;</td>
614           <td class="paramname"><em>tp</em></td><td>)</td>
615           <td></td>
616         </tr>
617       </table>
618 </div><div class="memdoc">
619
620 <p>Return the number of threads associated with the thread pool. </p>
621 <dl class="params"><dt>Parameters</dt><dd>
622   <table class="params">
623     <tr><td class="paramname">tp</td><td>the thread pool handle. </td></tr>
624   </table>
625   </dd>
626 </dl>
627 <dl class="section return"><dt>Returns</dt><dd>number of threads associated with the thread pool. </dd></dl>
628
629 <p>References <a class="el" href="structopj__thread__pool__t.html#a43fd14e3ba8409a0fac589a6dd4e7ee1">opj_thread_pool_t::worker_threads_count</a>.</p>
630
631 <p>Referenced by <a class="el" href="group___d_w_t.html#ga473550255363b8acb0c9b10a6dbac434">opj_dwt_decode_tile()</a>, and <a class="el" href="group___t1.html#ga20cf3c3ce3f470e6311e96bf6e365cb0">opj_t1_decode_cblks()</a>.</p>
632
633 </div>
634 </div>
635 <a class="anchor" id="gaf389ecb3a583a30077fc546eef767c89"></a>
636 <div class="memitem">
637 <div class="memproto">
638       <table class="memname">
639         <tr>
640           <td class="memname"><a class="el" href="openjpeg_8h.html#abb5dad6294f4611f1925388e919b16f4">OPJ_BOOL</a> opj_thread_pool_submit_job </td>
641           <td>(</td>
642           <td class="paramtype"><a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *&#160;</td>
643           <td class="paramname"><em>tp</em>, </td>
644         </tr>
645         <tr>
646           <td class="paramkey"></td>
647           <td></td>
648           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#gaf29983f3245378c30edbef61fe22913b">opj_job_fn</a>&#160;</td>
649           <td class="paramname"><em>job_fn</em>, </td>
650         </tr>
651         <tr>
652           <td class="paramkey"></td>
653           <td></td>
654           <td class="paramtype">void *&#160;</td>
655           <td class="paramname"><em>user_data</em>&#160;</td>
656         </tr>
657         <tr>
658           <td></td>
659           <td>)</td>
660           <td></td><td></td>
661         </tr>
662       </table>
663 </div><div class="memdoc">
664
665 <p>Submit a new job to be run by one of the thread in the thread pool. </p>
666 <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>
667 <dl class="params"><dt>Parameters</dt><dd>
668   <table class="params">
669     <tr><td class="paramname">tp</td><td>the thread pool handle. </td></tr>
670     <tr><td class="paramname">job_fn</td><td>Function to run. Must not be NULL. </td></tr>
671     <tr><td class="paramname">user_data</td><td>User data provided to thread_fn. </td></tr>
672   </table>
673   </dd>
674 </dl>
675 <dl class="section return"><dt>Returns</dt><dd>OPJ_TRUE if the job was successfully submitted. </dd></dl>
676
677 <p>References <a class="el" href="structopj__worker__thread__t.html#a8e7cdff9dab59b5be9ed46436437f28a">opj_worker_thread_t::cond</a>, <a class="el" href="structopj__thread__pool__t.html#a19d0f595937228552fe62c69cb2f6c44">opj_thread_pool_t::cond</a>, <a class="el" href="structopj__job__list__t.html#a84b556f2984f8f7a4b38cb0a075d3d1e">opj_job_list_t::job</a>, <a class="el" href="structopj__worker__thread__job__t.html#ab9dc542136b4596b711e3be011abdd4d">opj_worker_thread_job_t::job_fn</a>, <a class="el" href="structopj__thread__pool__t.html#aff15e4a4599fc823762f8d3c28d8353d">opj_thread_pool_t::job_queue</a>, <a class="el" href="structopj__worker__thread__t.html#a6cf93c9b46f4b51b9247a179f49fc796">opj_worker_thread_t::marked_as_waiting</a>, <a class="el" href="structopj__worker__thread__t.html#a2ba43db98feae7de2aaed97d08ec55ce">opj_worker_thread_t::mutex</a>, <a class="el" href="structopj__thread__pool__t.html#a818a719866334770dda95c675cb73d63">opj_thread_pool_t::mutex</a>, <a class="el" href="structopj__job__list__t.html#a27d174268d6050639a4032780172d87f">opj_job_list_t::next</a>, <a class="el" href="structopj__worker__thread__list__t.html#ac0a28fac91ec02c49898229a1122aa67">opj_worker_thread_list_t::next</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga0f3687b35d6f3c395e1156a8499d1632">opj_cond_signal()</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga6edf64f08cd0b48299800852d52245d6">opj_cond_wait()</a>, <a class="el" href="openjpeg_8h.html#ac672bfd7db39c609e828acb07a321964">OPJ_FALSE</a>, <a class="el" href="group___m_i_s_c.html#ga2bd00e2482ae36197631bde0665cfdfe">opj_free()</a>, <a class="el" href="group___m_i_s_c.html#ga49c70931cbed786f6eef5f095bcb2917">opj_malloc()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gab38a90b92a1d294f7e1886e36a405518">opj_mutex_lock()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gacf1f5a5f7f7257663505af02b717272c">opj_mutex_unlock()</a>, <a class="el" href="openjpeg_8h.html#a04830036d767cba56cbf5ae5bdc481d3">OPJ_TRUE</a>, <a class="el" href="structopj__thread__pool__t.html#ad84a2e09419498cf81c8994f0441b131">opj_thread_pool_t::pending_jobs_count</a>, <a class="el" href="structopj__thread__pool__t.html#ae68571d1cf6eae577c75df49c2827438">opj_thread_pool_t::signaling_threshold</a>, <a class="el" href="structopj__thread__pool__t.html#a401a98b276c965e0b63efaf9e1369730">opj_thread_pool_t::tls</a>, <a class="el" href="structopj__worker__thread__job__t.html#a89f225764ee25dabc5e374ed277cd286">opj_worker_thread_job_t::user_data</a>, <a class="el" href="structopj__thread__pool__t.html#abad6b35fb3cc6cd8aaaf523de9a4a187">opj_thread_pool_t::waiting_worker_thread_count</a>, <a class="el" href="structopj__thread__pool__t.html#a50c4caa87ba2a6767d909898cc92b37a">opj_thread_pool_t::waiting_worker_thread_list</a>, <a class="el" href="structopj__worker__thread__list__t.html#af36b36ba7fc3ab5febe59faf30c86c7f">opj_worker_thread_list_t::worker_thread</a>, and <a class="el" href="structopj__thread__pool__t.html#a43fd14e3ba8409a0fac589a6dd4e7ee1">opj_thread_pool_t::worker_threads_count</a>.</p>
678
679 <p>Referenced by <a class="el" href="group___d_w_t.html#ga473550255363b8acb0c9b10a6dbac434">opj_dwt_decode_tile()</a>, and <a class="el" href="group___t1.html#ga20cf3c3ce3f470e6311e96bf6e365cb0">opj_t1_decode_cblks()</a>.</p>
680
681 </div>
682 </div>
683 <a class="anchor" id="ga0ced26c80598e49bf3a964bb802130f1"></a>
684 <div class="memitem">
685 <div class="memproto">
686       <table class="memname">
687         <tr>
688           <td class="memname">void opj_thread_pool_wait_completion </td>
689           <td>(</td>
690           <td class="paramtype"><a class="el" href="structopj__thread__pool__t.html">opj_thread_pool_t</a> *&#160;</td>
691           <td class="paramname"><em>tp</em>, </td>
692         </tr>
693         <tr>
694           <td class="paramkey"></td>
695           <td></td>
696           <td class="paramtype">int&#160;</td>
697           <td class="paramname"><em>max_remaining_jobs</em>&#160;</td>
698         </tr>
699         <tr>
700           <td></td>
701           <td>)</td>
702           <td></td><td></td>
703         </tr>
704       </table>
705 </div><div class="memdoc">
706
707 <p>Wait that no more than max_remaining_jobs jobs are remaining in the queue of the thread pool. </p>
708 <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>
709 <dl class="params"><dt>Parameters</dt><dd>
710   <table class="params">
711     <tr><td class="paramname">tp</td><td>the thread pool handle </td></tr>
712     <tr><td class="paramname">max_remaining_jobs</td><td>maximum number of jobs allowed to be queued without waiting. </td></tr>
713   </table>
714   </dd>
715 </dl>
716
717 <p>References <a class="el" href="structopj__thread__pool__t.html#a19d0f595937228552fe62c69cb2f6c44">opj_thread_pool_t::cond</a>, <a class="el" href="structopj__thread__pool__t.html#a818a719866334770dda95c675cb73d63">opj_thread_pool_t::mutex</a>, <a class="el" href="group___t_h_r_e_a_d.html#ga6edf64f08cd0b48299800852d52245d6">opj_cond_wait()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gab38a90b92a1d294f7e1886e36a405518">opj_mutex_lock()</a>, <a class="el" href="group___t_h_r_e_a_d.html#gacf1f5a5f7f7257663505af02b717272c">opj_mutex_unlock()</a>, <a class="el" href="structopj__thread__pool__t.html#ad84a2e09419498cf81c8994f0441b131">opj_thread_pool_t::pending_jobs_count</a>, and <a class="el" href="structopj__thread__pool__t.html#ae68571d1cf6eae577c75df49c2827438">opj_thread_pool_t::signaling_threshold</a>.</p>
718
719 <p>Referenced by <a class="el" href="group___d_w_t.html#ga473550255363b8acb0c9b10a6dbac434">opj_dwt_decode_tile()</a>, <a class="el" href="tcd_8c.html#a61608d1a920574e556d417a4b0e23a3a">opj_tcd_t1_decode()</a>, and <a class="el" href="group___t_h_r_e_a_d.html#gae44e8b9258d0baa19e3671a382faa33e">opj_thread_pool_destroy()</a>.</p>
720
721 </div>
722 </div>
723 <a class="anchor" id="ga90caa0ff9c1e54033ef1e3010faf03a9"></a>
724 <div class="memitem">
725 <div class="memproto">
726       <table class="memname">
727         <tr>
728           <td class="memname">void* opj_tls_get </td>
729           <td>(</td>
730           <td class="paramtype"><a class="el" href="structopj__tls__t.html">opj_tls_t</a> *&#160;</td>
731           <td class="paramname"><em>tls</em>, </td>
732         </tr>
733         <tr>
734           <td class="paramkey"></td>
735           <td></td>
736           <td class="paramtype">int&#160;</td>
737           <td class="paramname"><em>key</em>&#160;</td>
738         </tr>
739         <tr>
740           <td></td>
741           <td>)</td>
742           <td></td><td></td>
743         </tr>
744       </table>
745 </div><div class="memdoc">
746
747 <p>Get a thread local value corresponding to the provided key. </p>
748 <dl class="params"><dt>Parameters</dt><dd>
749   <table class="params">
750     <tr><td class="paramname">tls</td><td>thread local storage handle </td></tr>
751     <tr><td class="paramname">key</td><td>key whose value to retrieve. </td></tr>
752   </table>
753   </dd>
754 </dl>
755 <dl class="section return"><dt>Returns</dt><dd>value associated with the key, or NULL is missing. </dd></dl>
756
757 <p>References <a class="el" href="structopj__tls__key__val__t.html#ad6fb434626095a18d07e1f617c1caa4a">opj_tls_key_val_t::key</a>, <a class="el" href="structopj__tls__t.html#adfd2bdbeb80b7f067288709b3c3fc1aa">opj_tls_t::key_val</a>, <a class="el" href="structopj__tls__t.html#ae2c441fd26b7ae11a86163d5bebb4d2e">opj_tls_t::key_val_count</a>, and <a class="el" href="structopj__tls__key__val__t.html#a58ca4c6fe1d0342a77b89bb240a6f549">opj_tls_key_val_t::value</a>.</p>
758
759 <p>Referenced by <a class="el" href="t1_8c.html#a4f37cf7aca8eb1313fe5bc320c85ad55">opj_t1_clbl_decode_processor()</a>.</p>
760
761 </div>
762 </div>
763 <a class="anchor" id="gab1b97098aabc89f98eca8f8f7274f3e7"></a>
764 <div class="memitem">
765 <div class="memproto">
766       <table class="memname">
767         <tr>
768           <td class="memname"><a class="el" href="openjpeg_8h.html#abb5dad6294f4611f1925388e919b16f4">OPJ_BOOL</a> opj_tls_set </td>
769           <td>(</td>
770           <td class="paramtype"><a class="el" href="structopj__tls__t.html">opj_tls_t</a> *&#160;</td>
771           <td class="paramname"><em>tls</em>, </td>
772         </tr>
773         <tr>
774           <td class="paramkey"></td>
775           <td></td>
776           <td class="paramtype">int&#160;</td>
777           <td class="paramname"><em>key</em>, </td>
778         </tr>
779         <tr>
780           <td class="paramkey"></td>
781           <td></td>
782           <td class="paramtype">void *&#160;</td>
783           <td class="paramname"><em>value</em>, </td>
784         </tr>
785         <tr>
786           <td class="paramkey"></td>
787           <td></td>
788           <td class="paramtype"><a class="el" href="group___t_h_r_e_a_d.html#ga38f8cdfd288c8ff8963444403549ad6c">opj_tls_free_func</a>&#160;</td>
789           <td class="paramname"><em>free_func</em>&#160;</td>
790         </tr>
791         <tr>
792           <td></td>
793           <td>)</td>
794           <td></td><td></td>
795         </tr>
796       </table>
797 </div><div class="memdoc">
798
799 <p>Set a thread local value corresponding to the provided key. </p>
800 <dl class="params"><dt>Parameters</dt><dd>
801   <table class="params">
802     <tr><td class="paramname">tls</td><td>thread local storage handle </td></tr>
803     <tr><td class="paramname">key</td><td>key whose value to set. </td></tr>
804     <tr><td class="paramname">value</td><td>value to set (may be NULL). </td></tr>
805     <tr><td class="paramname">free_func</td><td>function to call currently installed value. </td></tr>
806   </table>
807   </dd>
808 </dl>
809 <dl class="section return"><dt>Returns</dt><dd>OPJ_TRUE if successful. </dd></dl>
810
811 <p>References <a class="el" href="structopj__tls__key__val__t.html#ad6fb434626095a18d07e1f617c1caa4a">opj_tls_key_val_t::key</a>, <a class="el" href="structopj__tls__t.html#adfd2bdbeb80b7f067288709b3c3fc1aa">opj_tls_t::key_val</a>, <a class="el" href="structopj__tls__t.html#ae2c441fd26b7ae11a86163d5bebb4d2e">opj_tls_t::key_val_count</a>, <a class="el" href="openjpeg_8h.html#ac672bfd7db39c609e828acb07a321964">OPJ_FALSE</a>, <a class="el" href="structopj__tls__key__val__t.html#a3a1ff12d54b55c7d3e30f31b10ad261e">opj_tls_key_val_t::opj_free_func</a>, <a class="el" href="group___m_i_s_c.html#ga95862b2a456efdc436c61beba816fb25">opj_realloc()</a>, <a class="el" href="openjpeg_8h.html#a04830036d767cba56cbf5ae5bdc481d3">OPJ_TRUE</a>, and <a class="el" href="structopj__tls__key__val__t.html#a58ca4c6fe1d0342a77b89bb240a6f549">opj_tls_key_val_t::value</a>.</p>
812
813 <p>Referenced by <a class="el" href="t1_8c.html#a4f37cf7aca8eb1313fe5bc320c85ad55">opj_t1_clbl_decode_processor()</a>.</p>
814
815 </div>
816 </div>
817 </div><!-- contents -->
818 <!-- start footer part -->
819 <hr class="footer"/><address class="footer"><small>
820 Generated by &#160;<a href="http://www.doxygen.org/index.html">
821 <img class="footer" src="doxygen.png" alt="doxygen"/>
822 </a> 1.8.10
823 </small></address>
824 </body>
825 </html>