Thread_8c.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.17"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>MQTT C Client Libraries Internals: Thread.c File Reference</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
  24. <td id="projectalign" style="padding-left: 0.5em;">
  25. <div id="projectname">MQTT C Client Libraries Internals
  26. </div>
  27. </td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. </div>
  32. <!-- end header part -->
  33. <!-- Generated by Doxygen 1.8.17 -->
  34. <script type="text/javascript">
  35. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  36. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  37. /* @license-end */
  38. </script>
  39. <script type="text/javascript" src="menudata.js"></script>
  40. <script type="text/javascript" src="menu.js"></script>
  41. <script type="text/javascript">
  42. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  43. $(function() {
  44. initMenu('',true,false,'search.php','Search');
  45. $(document).ready(function() { init_search(); });
  46. });
  47. /* @license-end */</script>
  48. <div id="main-nav"></div>
  49. <!-- window showing the filter options -->
  50. <div id="MSearchSelectWindow"
  51. onmouseover="return searchBox.OnSearchSelectShow()"
  52. onmouseout="return searchBox.OnSearchSelectHide()"
  53. onkeydown="return searchBox.OnSearchSelectKey(event)">
  54. </div>
  55. <!-- iframe showing the search results (closed by default) -->
  56. <div id="MSearchResultsWindow">
  57. <iframe src="javascript:void(0)" frameborder="0"
  58. name="MSearchResults" id="MSearchResults">
  59. </iframe>
  60. </div>
  61. </div><!-- top -->
  62. <div class="header">
  63. <div class="summary">
  64. <a href="#define-members">Macros</a> &#124;
  65. <a href="#func-members">Functions</a> </div>
  66. <div class="headertitle">
  67. <div class="title">Thread.c File Reference</div> </div>
  68. </div><!--header-->
  69. <div class="contents">
  70. <p>Threading related functions.
  71. <a href="#details">More...</a></p>
  72. <div class="textblock"><code>#include &quot;Thread.h&quot;</code><br />
  73. <code>#include &quot;Log.h&quot;</code><br />
  74. <code>#include &quot;StackTrace.h&quot;</code><br />
  75. <code>#include &lt;errno.h&gt;</code><br />
  76. <code>#include &lt;unistd.h&gt;</code><br />
  77. <code>#include &lt;sys/time.h&gt;</code><br />
  78. <code>#include &lt;fcntl.h&gt;</code><br />
  79. <code>#include &lt;stdio.h&gt;</code><br />
  80. <code>#include &lt;sys/stat.h&gt;</code><br />
  81. <code>#include &lt;limits.h&gt;</code><br />
  82. <code>#include &lt;stdlib.h&gt;</code><br />
  83. <code>#include &quot;OsWrapper.h&quot;</code><br />
  84. </div><div class="textblock"><div class="dynheader">
  85. Include dependency graph for Thread.c:</div>
  86. <div class="dyncontent">
  87. <div class="center"><img src="Thread_8c__incl.png" border="0" usemap="#Thread_8c" alt=""/></div>
  88. <map name="Thread_8c" id="Thread_8c">
  89. <area shape="rect" title="Threading related functions." alt="" coords="321,5,393,32"/>
  90. <area shape="rect" title=" " alt="" coords="5,80,67,107"/>
  91. <area shape="rect" title=" " alt="" coords="91,80,157,107"/>
  92. <area shape="rect" title=" " alt="" coords="182,80,263,107"/>
  93. <area shape="rect" title=" " alt="" coords="287,80,345,107"/>
  94. <area shape="rect" title=" " alt="" coords="369,80,429,107"/>
  95. <area shape="rect" title=" " alt="" coords="453,80,531,107"/>
  96. <area shape="rect" title=" " alt="" coords="555,80,618,107"/>
  97. <area shape="rect" title=" " alt="" coords="642,80,705,107"/>
  98. </map>
  99. </div>
  100. </div><table class="memberdecls">
  101. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  102. Functions</h2></td></tr>
  103. <tr class="memitem:a25288643d5e1a2ab1369132a80c58ce4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a25288643d5e1a2ab1369132a80c58ce4">Thread_start</a> (thread_fn fn, void *parameter)</td></tr>
  104. <tr class="memdesc:a25288643d5e1a2ab1369132a80c58ce4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start a new thread. <a href="Thread_8c.html#a25288643d5e1a2ab1369132a80c58ce4">More...</a><br /></td></tr>
  105. <tr class="separator:a25288643d5e1a2ab1369132a80c58ce4"><td class="memSeparator" colspan="2">&#160;</td></tr>
  106. <tr class="memitem:a4bd33fc4aeea77c32f7145bc8582b535"><td class="memItemLeft" align="right" valign="top"><a id="a4bd33fc4aeea77c32f7145bc8582b535"></a>
  107. int&#160;</td><td class="memItemRight" valign="bottom"><b>Thread_set_name</b> (const char *thread_name)</td></tr>
  108. <tr class="separator:a4bd33fc4aeea77c32f7145bc8582b535"><td class="memSeparator" colspan="2">&#160;</td></tr>
  109. <tr class="memitem:a6c1b6aaeb2f7e1d5b4a4936f0568b868"><td class="memItemLeft" align="right" valign="top">mutex_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a6c1b6aaeb2f7e1d5b4a4936f0568b868">Thread_create_mutex</a> (int *rc)</td></tr>
  110. <tr class="memdesc:a6c1b6aaeb2f7e1d5b4a4936f0568b868"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new mutex. <a href="Thread_8c.html#a6c1b6aaeb2f7e1d5b4a4936f0568b868">More...</a><br /></td></tr>
  111. <tr class="separator:a6c1b6aaeb2f7e1d5b4a4936f0568b868"><td class="memSeparator" colspan="2">&#160;</td></tr>
  112. <tr class="memitem:a7e92185eb22775c76e1b6b8865468f17"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17">Thread_lock_mutex</a> (mutex_type mutex)</td></tr>
  113. <tr class="memdesc:a7e92185eb22775c76e1b6b8865468f17"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lock a mutex which has alrea. <a href="Thread_8c.html#a7e92185eb22775c76e1b6b8865468f17">More...</a><br /></td></tr>
  114. <tr class="separator:a7e92185eb22775c76e1b6b8865468f17"><td class="memSeparator" colspan="2">&#160;</td></tr>
  115. <tr class="memitem:a5faf758226199e7cf93f6b489aca07f7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a5faf758226199e7cf93f6b489aca07f7">Thread_unlock_mutex</a> (mutex_type mutex)</td></tr>
  116. <tr class="memdesc:a5faf758226199e7cf93f6b489aca07f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unlock a mutex which has already been locked. <a href="Thread_8c.html#a5faf758226199e7cf93f6b489aca07f7">More...</a><br /></td></tr>
  117. <tr class="separator:a5faf758226199e7cf93f6b489aca07f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
  118. <tr class="memitem:ab586558bf9d7030f479ca574ea7e55a4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ab586558bf9d7030f479ca574ea7e55a4">Thread_destroy_mutex</a> (mutex_type mutex)</td></tr>
  119. <tr class="memdesc:ab586558bf9d7030f479ca574ea7e55a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a mutex which has already been created. <a href="Thread_8c.html#ab586558bf9d7030f479ca574ea7e55a4">More...</a><br /></td></tr>
  120. <tr class="separator:ab586558bf9d7030f479ca574ea7e55a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
  121. <tr class="memitem:a216e79bc196440343aa802dfad8dc38b"><td class="memItemLeft" align="right" valign="top">thread_id_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a216e79bc196440343aa802dfad8dc38b">Thread_getid</a> (void)</td></tr>
  122. <tr class="memdesc:a216e79bc196440343aa802dfad8dc38b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the thread id of the thread from which this function is called. <a href="Thread_8c.html#a216e79bc196440343aa802dfad8dc38b">More...</a><br /></td></tr>
  123. <tr class="separator:a216e79bc196440343aa802dfad8dc38b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  124. <tr class="memitem:a3b9b6cb543ee55442d2037a971f651db"><td class="memItemLeft" align="right" valign="top">sem_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a3b9b6cb543ee55442d2037a971f651db">Thread_create_sem</a> (int *rc)</td></tr>
  125. <tr class="memdesc:a3b9b6cb543ee55442d2037a971f651db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new semaphore. <a href="Thread_8c.html#a3b9b6cb543ee55442d2037a971f651db">More...</a><br /></td></tr>
  126. <tr class="separator:a3b9b6cb543ee55442d2037a971f651db"><td class="memSeparator" colspan="2">&#160;</td></tr>
  127. <tr class="memitem:a4d0bbfc059da3cd10626244d3468d319"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a4d0bbfc059da3cd10626244d3468d319">Thread_wait_sem</a> (sem_type sem, int timeout)</td></tr>
  128. <tr class="memdesc:a4d0bbfc059da3cd10626244d3468d319"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait for a semaphore to be posted, or timeout. <a href="Thread_8c.html#a4d0bbfc059da3cd10626244d3468d319">More...</a><br /></td></tr>
  129. <tr class="separator:a4d0bbfc059da3cd10626244d3468d319"><td class="memSeparator" colspan="2">&#160;</td></tr>
  130. <tr class="memitem:ad327c467c568b27be4c3676fc698e129"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ad327c467c568b27be4c3676fc698e129">Thread_check_sem</a> (sem_type sem)</td></tr>
  131. <tr class="memdesc:ad327c467c568b27be4c3676fc698e129"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged, if the return value is false. <a href="Thread_8c.html#ad327c467c568b27be4c3676fc698e129">More...</a><br /></td></tr>
  132. <tr class="separator:ad327c467c568b27be4c3676fc698e129"><td class="memSeparator" colspan="2">&#160;</td></tr>
  133. <tr class="memitem:ac023f527bed9c6c3a20244fa7efe272c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ac023f527bed9c6c3a20244fa7efe272c">Thread_post_sem</a> (sem_type sem)</td></tr>
  134. <tr class="memdesc:ac023f527bed9c6c3a20244fa7efe272c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Post a semaphore. <a href="Thread_8c.html#ac023f527bed9c6c3a20244fa7efe272c">More...</a><br /></td></tr>
  135. <tr class="separator:ac023f527bed9c6c3a20244fa7efe272c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  136. <tr class="memitem:ad075ec07f801ac1a2a7dee7097048182"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ad075ec07f801ac1a2a7dee7097048182">Thread_destroy_sem</a> (sem_type sem)</td></tr>
  137. <tr class="memdesc:ad075ec07f801ac1a2a7dee7097048182"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a semaphore which has already been created. <a href="Thread_8c.html#ad075ec07f801ac1a2a7dee7097048182">More...</a><br /></td></tr>
  138. <tr class="separator:ad075ec07f801ac1a2a7dee7097048182"><td class="memSeparator" colspan="2">&#160;</td></tr>
  139. <tr class="memitem:afdd152c518f968c777012d7dfb20ef96"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#afdd152c518f968c777012d7dfb20ef96">Thread_create_cond</a> (int *rc)</td></tr>
  140. <tr class="memdesc:afdd152c518f968c777012d7dfb20ef96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new condition variable. <a href="Thread_8c.html#afdd152c518f968c777012d7dfb20ef96">More...</a><br /></td></tr>
  141. <tr class="separator:afdd152c518f968c777012d7dfb20ef96"><td class="memSeparator" colspan="2">&#160;</td></tr>
  142. <tr class="memitem:a7b0d40dc1603a6e93db0ee970bb6750f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a7b0d40dc1603a6e93db0ee970bb6750f">Thread_signal_cond</a> (<a class="el" href="structcond__type__struct.html">cond_type</a> condvar)</td></tr>
  143. <tr class="memdesc:a7b0d40dc1603a6e93db0ee970bb6750f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signal a condition variable. <a href="Thread_8c.html#a7b0d40dc1603a6e93db0ee970bb6750f">More...</a><br /></td></tr>
  144. <tr class="separator:a7b0d40dc1603a6e93db0ee970bb6750f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  145. <tr class="memitem:acd23266878de6faaee0a972ef74c4db6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#acd23266878de6faaee0a972ef74c4db6">Thread_wait_cond</a> (<a class="el" href="structcond__type__struct.html">cond_type</a> condvar, int timeout_ms)</td></tr>
  146. <tr class="memdesc:acd23266878de6faaee0a972ef74c4db6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait with a timeout (ms) for condition variable. <a href="Thread_8c.html#acd23266878de6faaee0a972ef74c4db6">More...</a><br /></td></tr>
  147. <tr class="separator:acd23266878de6faaee0a972ef74c4db6"><td class="memSeparator" colspan="2">&#160;</td></tr>
  148. <tr class="memitem:a95309628f2c15de1f3ea8047b086a707"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a95309628f2c15de1f3ea8047b086a707">Thread_destroy_cond</a> (<a class="el" href="structcond__type__struct.html">cond_type</a> condvar)</td></tr>
  149. <tr class="memdesc:a95309628f2c15de1f3ea8047b086a707"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a condition variable. <a href="Thread_8c.html#a95309628f2c15de1f3ea8047b086a707">More...</a><br /></td></tr>
  150. <tr class="separator:a95309628f2c15de1f3ea8047b086a707"><td class="memSeparator" colspan="2">&#160;</td></tr>
  151. </table>
  152. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  153. <div class="textblock"><p>Threading related functions. </p>
  154. <p>Used to create platform independent threading functions </p>
  155. </div><h2 class="groupheader">Function Documentation</h2>
  156. <a id="ad327c467c568b27be4c3676fc698e129"></a>
  157. <h2 class="memtitle"><span class="permalink"><a href="#ad327c467c568b27be4c3676fc698e129">&#9670;&nbsp;</a></span>Thread_check_sem()</h2>
  158. <div class="memitem">
  159. <div class="memproto">
  160. <table class="memname">
  161. <tr>
  162. <td class="memname">int Thread_check_sem </td>
  163. <td>(</td>
  164. <td class="paramtype">sem_type&#160;</td>
  165. <td class="paramname"><em>sem</em></td><td>)</td>
  166. <td></td>
  167. </tr>
  168. </table>
  169. </div><div class="memdoc">
  170. <p>Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged, if the return value is false. </p>
  171. <p>The semaphore will have been decremented, if the return value is true. </p><dl class="params"><dt>Parameters</dt><dd>
  172. <table class="params">
  173. <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  174. </table>
  175. </dd>
  176. </dl>
  177. <dl class="section return"><dt>Returns</dt><dd>0 (false) or 1 (true) </dd></dl>
  178. </div>
  179. </div>
  180. <a id="afdd152c518f968c777012d7dfb20ef96"></a>
  181. <h2 class="memtitle"><span class="permalink"><a href="#afdd152c518f968c777012d7dfb20ef96">&#9670;&nbsp;</a></span>Thread_create_cond()</h2>
  182. <div class="memitem">
  183. <div class="memproto">
  184. <table class="memname">
  185. <tr>
  186. <td class="memname"><a class="el" href="structcond__type__struct.html">cond_type</a> Thread_create_cond </td>
  187. <td>(</td>
  188. <td class="paramtype">int *&#160;</td>
  189. <td class="paramname"><em>rc</em></td><td>)</td>
  190. <td></td>
  191. </tr>
  192. </table>
  193. </div><div class="memdoc">
  194. <p>Create a new condition variable. </p>
  195. <dl class="section return"><dt>Returns</dt><dd>the condition variable struct </dd></dl>
  196. <div class="dynheader">
  197. Here is the call graph for this function:</div>
  198. <div class="dyncontent">
  199. <div class="center"><img src="Thread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph.png" border="0" usemap="#Thread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph" alt=""/></div>
  200. <map name="Thread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph" id="Thread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph">
  201. <area shape="rect" title="Create a new condition variable." alt="" coords="5,5,145,32"/>
  202. <area shape="rect" href="Log_8c.html#a669722e3f57811871f97c12392aba85d" title="Log a message." alt="" coords="193,5,237,32"/>
  203. </map>
  204. </div>
  205. </div>
  206. </div>
  207. <a id="a6c1b6aaeb2f7e1d5b4a4936f0568b868"></a>
  208. <h2 class="memtitle"><span class="permalink"><a href="#a6c1b6aaeb2f7e1d5b4a4936f0568b868">&#9670;&nbsp;</a></span>Thread_create_mutex()</h2>
  209. <div class="memitem">
  210. <div class="memproto">
  211. <table class="memname">
  212. <tr>
  213. <td class="memname">mutex_type Thread_create_mutex </td>
  214. <td>(</td>
  215. <td class="paramtype">int *&#160;</td>
  216. <td class="paramname"><em>rc</em></td><td>)</td>
  217. <td></td>
  218. </tr>
  219. </table>
  220. </div><div class="memdoc">
  221. <p>Create a new mutex. </p>
  222. <dl class="params"><dt>Parameters</dt><dd>
  223. <table class="params">
  224. <tr><td class="paramname">rc</td><td>return code: 0 for success, negative otherwise </td></tr>
  225. </table>
  226. </dd>
  227. </dl>
  228. <dl class="section return"><dt>Returns</dt><dd>the new mutex </dd></dl>
  229. </div>
  230. </div>
  231. <a id="a3b9b6cb543ee55442d2037a971f651db"></a>
  232. <h2 class="memtitle"><span class="permalink"><a href="#a3b9b6cb543ee55442d2037a971f651db">&#9670;&nbsp;</a></span>Thread_create_sem()</h2>
  233. <div class="memitem">
  234. <div class="memproto">
  235. <table class="memname">
  236. <tr>
  237. <td class="memname">sem_type Thread_create_sem </td>
  238. <td>(</td>
  239. <td class="paramtype">int *&#160;</td>
  240. <td class="paramname"><em>rc</em></td><td>)</td>
  241. <td></td>
  242. </tr>
  243. </table>
  244. </div><div class="memdoc">
  245. <p>Create a new semaphore. </p>
  246. <dl class="params"><dt>Parameters</dt><dd>
  247. <table class="params">
  248. <tr><td class="paramname">rc</td><td>return code: 0 for success, negative otherwise </td></tr>
  249. </table>
  250. </dd>
  251. </dl>
  252. <dl class="section return"><dt>Returns</dt><dd>the new condition variable </dd></dl>
  253. </div>
  254. </div>
  255. <a id="a95309628f2c15de1f3ea8047b086a707"></a>
  256. <h2 class="memtitle"><span class="permalink"><a href="#a95309628f2c15de1f3ea8047b086a707">&#9670;&nbsp;</a></span>Thread_destroy_cond()</h2>
  257. <div class="memitem">
  258. <div class="memproto">
  259. <table class="memname">
  260. <tr>
  261. <td class="memname">int Thread_destroy_cond </td>
  262. <td>(</td>
  263. <td class="paramtype"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td>
  264. <td class="paramname"><em>condvar</em></td><td>)</td>
  265. <td></td>
  266. </tr>
  267. </table>
  268. </div><div class="memdoc">
  269. <p>Destroy a condition variable. </p>
  270. <dl class="section return"><dt>Returns</dt><dd>completion code </dd></dl>
  271. </div>
  272. </div>
  273. <a id="ab586558bf9d7030f479ca574ea7e55a4"></a>
  274. <h2 class="memtitle"><span class="permalink"><a href="#ab586558bf9d7030f479ca574ea7e55a4">&#9670;&nbsp;</a></span>Thread_destroy_mutex()</h2>
  275. <div class="memitem">
  276. <div class="memproto">
  277. <table class="memname">
  278. <tr>
  279. <td class="memname">int Thread_destroy_mutex </td>
  280. <td>(</td>
  281. <td class="paramtype">mutex_type&#160;</td>
  282. <td class="paramname"><em>mutex</em></td><td>)</td>
  283. <td></td>
  284. </tr>
  285. </table>
  286. </div><div class="memdoc">
  287. <p>Destroy a mutex which has already been created. </p>
  288. <dl class="params"><dt>Parameters</dt><dd>
  289. <table class="params">
  290. <tr><td class="paramname">mutex</td><td>the mutex </td></tr>
  291. </table>
  292. </dd>
  293. </dl>
  294. </div>
  295. </div>
  296. <a id="ad075ec07f801ac1a2a7dee7097048182"></a>
  297. <h2 class="memtitle"><span class="permalink"><a href="#ad075ec07f801ac1a2a7dee7097048182">&#9670;&nbsp;</a></span>Thread_destroy_sem()</h2>
  298. <div class="memitem">
  299. <div class="memproto">
  300. <table class="memname">
  301. <tr>
  302. <td class="memname">int Thread_destroy_sem </td>
  303. <td>(</td>
  304. <td class="paramtype">sem_type&#160;</td>
  305. <td class="paramname"><em>sem</em></td><td>)</td>
  306. <td></td>
  307. </tr>
  308. </table>
  309. </div><div class="memdoc">
  310. <p>Destroy a semaphore which has already been created. </p>
  311. <dl class="params"><dt>Parameters</dt><dd>
  312. <table class="params">
  313. <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  314. </table>
  315. </dd>
  316. </dl>
  317. </div>
  318. </div>
  319. <a id="a216e79bc196440343aa802dfad8dc38b"></a>
  320. <h2 class="memtitle"><span class="permalink"><a href="#a216e79bc196440343aa802dfad8dc38b">&#9670;&nbsp;</a></span>Thread_getid()</h2>
  321. <div class="memitem">
  322. <div class="memproto">
  323. <table class="memname">
  324. <tr>
  325. <td class="memname">thread_id_type Thread_getid </td>
  326. <td>(</td>
  327. <td class="paramtype">void&#160;</td>
  328. <td class="paramname"></td><td>)</td>
  329. <td></td>
  330. </tr>
  331. </table>
  332. </div><div class="memdoc">
  333. <p>Get the thread id of the thread from which this function is called. </p>
  334. <dl class="section return"><dt>Returns</dt><dd>thread id, type varying according to OS </dd></dl>
  335. </div>
  336. </div>
  337. <a id="a7e92185eb22775c76e1b6b8865468f17"></a>
  338. <h2 class="memtitle"><span class="permalink"><a href="#a7e92185eb22775c76e1b6b8865468f17">&#9670;&nbsp;</a></span>Thread_lock_mutex()</h2>
  339. <div class="memitem">
  340. <div class="memproto">
  341. <table class="memname">
  342. <tr>
  343. <td class="memname">int Thread_lock_mutex </td>
  344. <td>(</td>
  345. <td class="paramtype">mutex_type&#160;</td>
  346. <td class="paramname"><em>mutex</em></td><td>)</td>
  347. <td></td>
  348. </tr>
  349. </table>
  350. </div><div class="memdoc">
  351. <p>Lock a mutex which has alrea. </p>
  352. <dl class="section return"><dt>Returns</dt><dd>completion code, 0 is success </dd></dl>
  353. </div>
  354. </div>
  355. <a id="ac023f527bed9c6c3a20244fa7efe272c"></a>
  356. <h2 class="memtitle"><span class="permalink"><a href="#ac023f527bed9c6c3a20244fa7efe272c">&#9670;&nbsp;</a></span>Thread_post_sem()</h2>
  357. <div class="memitem">
  358. <div class="memproto">
  359. <table class="memname">
  360. <tr>
  361. <td class="memname">int Thread_post_sem </td>
  362. <td>(</td>
  363. <td class="paramtype">sem_type&#160;</td>
  364. <td class="paramname"><em>sem</em></td><td>)</td>
  365. <td></td>
  366. </tr>
  367. </table>
  368. </div><div class="memdoc">
  369. <p>Post a semaphore. </p>
  370. <dl class="params"><dt>Parameters</dt><dd>
  371. <table class="params">
  372. <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  373. </table>
  374. </dd>
  375. </dl>
  376. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  377. </div>
  378. </div>
  379. <a id="a7b0d40dc1603a6e93db0ee970bb6750f"></a>
  380. <h2 class="memtitle"><span class="permalink"><a href="#a7b0d40dc1603a6e93db0ee970bb6750f">&#9670;&nbsp;</a></span>Thread_signal_cond()</h2>
  381. <div class="memitem">
  382. <div class="memproto">
  383. <table class="memname">
  384. <tr>
  385. <td class="memname">int Thread_signal_cond </td>
  386. <td>(</td>
  387. <td class="paramtype"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td>
  388. <td class="paramname"><em>condvar</em></td><td>)</td>
  389. <td></td>
  390. </tr>
  391. </table>
  392. </div><div class="memdoc">
  393. <p>Signal a condition variable. </p>
  394. <dl class="section return"><dt>Returns</dt><dd>completion code </dd></dl>
  395. </div>
  396. </div>
  397. <a id="a25288643d5e1a2ab1369132a80c58ce4"></a>
  398. <h2 class="memtitle"><span class="permalink"><a href="#a25288643d5e1a2ab1369132a80c58ce4">&#9670;&nbsp;</a></span>Thread_start()</h2>
  399. <div class="memitem">
  400. <div class="memproto">
  401. <table class="memname">
  402. <tr>
  403. <td class="memname">void Thread_start </td>
  404. <td>(</td>
  405. <td class="paramtype">thread_fn&#160;</td>
  406. <td class="paramname"><em>fn</em>, </td>
  407. </tr>
  408. <tr>
  409. <td class="paramkey"></td>
  410. <td></td>
  411. <td class="paramtype">void *&#160;</td>
  412. <td class="paramname"><em>parameter</em>&#160;</td>
  413. </tr>
  414. <tr>
  415. <td></td>
  416. <td>)</td>
  417. <td></td><td></td>
  418. </tr>
  419. </table>
  420. </div><div class="memdoc">
  421. <p>Start a new thread. </p>
  422. <dl class="params"><dt>Parameters</dt><dd>
  423. <table class="params">
  424. <tr><td class="paramname">fn</td><td>the function to run, must be of the correct signature </td></tr>
  425. <tr><td class="paramname">parameter</td><td>pointer to the function parameter, can be NULL </td></tr>
  426. </table>
  427. </dd>
  428. </dl>
  429. </div>
  430. </div>
  431. <a id="a5faf758226199e7cf93f6b489aca07f7"></a>
  432. <h2 class="memtitle"><span class="permalink"><a href="#a5faf758226199e7cf93f6b489aca07f7">&#9670;&nbsp;</a></span>Thread_unlock_mutex()</h2>
  433. <div class="memitem">
  434. <div class="memproto">
  435. <table class="memname">
  436. <tr>
  437. <td class="memname">int Thread_unlock_mutex </td>
  438. <td>(</td>
  439. <td class="paramtype">mutex_type&#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. <p>Unlock a mutex which has already been locked. </p>
  446. <dl class="params"><dt>Parameters</dt><dd>
  447. <table class="params">
  448. <tr><td class="paramname">mutex</td><td>the mutex </td></tr>
  449. </table>
  450. </dd>
  451. </dl>
  452. <dl class="section return"><dt>Returns</dt><dd>completion code, 0 is success </dd></dl>
  453. </div>
  454. </div>
  455. <a id="acd23266878de6faaee0a972ef74c4db6"></a>
  456. <h2 class="memtitle"><span class="permalink"><a href="#acd23266878de6faaee0a972ef74c4db6">&#9670;&nbsp;</a></span>Thread_wait_cond()</h2>
  457. <div class="memitem">
  458. <div class="memproto">
  459. <table class="memname">
  460. <tr>
  461. <td class="memname">int Thread_wait_cond </td>
  462. <td>(</td>
  463. <td class="paramtype"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td>
  464. <td class="paramname"><em>condvar</em>, </td>
  465. </tr>
  466. <tr>
  467. <td class="paramkey"></td>
  468. <td></td>
  469. <td class="paramtype">int&#160;</td>
  470. <td class="paramname"><em>timeout_ms</em>&#160;</td>
  471. </tr>
  472. <tr>
  473. <td></td>
  474. <td>)</td>
  475. <td></td><td></td>
  476. </tr>
  477. </table>
  478. </div><div class="memdoc">
  479. <p>Wait with a timeout (ms) for condition variable. </p>
  480. <dl class="section return"><dt>Returns</dt><dd>0 for success, ETIMEDOUT otherwise </dd></dl>
  481. </div>
  482. </div>
  483. <a id="a4d0bbfc059da3cd10626244d3468d319"></a>
  484. <h2 class="memtitle"><span class="permalink"><a href="#a4d0bbfc059da3cd10626244d3468d319">&#9670;&nbsp;</a></span>Thread_wait_sem()</h2>
  485. <div class="memitem">
  486. <div class="memproto">
  487. <table class="memname">
  488. <tr>
  489. <td class="memname">int Thread_wait_sem </td>
  490. <td>(</td>
  491. <td class="paramtype">sem_type&#160;</td>
  492. <td class="paramname"><em>sem</em>, </td>
  493. </tr>
  494. <tr>
  495. <td class="paramkey"></td>
  496. <td></td>
  497. <td class="paramtype">int&#160;</td>
  498. <td class="paramname"><em>timeout</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. <p>Wait for a semaphore to be posted, or timeout. </p>
  508. <dl class="params"><dt>Parameters</dt><dd>
  509. <table class="params">
  510. <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  511. <tr><td class="paramname">timeout</td><td>the maximum time to wait, in milliseconds </td></tr>
  512. </table>
  513. </dd>
  514. </dl>
  515. <dl class="section return"><dt>Returns</dt><dd>completion code </dd></dl>
  516. </div>
  517. </div>
  518. </div><!-- contents -->
  519. <!-- start footer part -->
  520. <hr class="footer"/><address class="footer"><small>
  521. Generated on Thu Sep 29 2022 11:34:46 for MQTT C Client Libraries Internals by &#160;<a href="http://www.doxygen.org/index.html">
  522. <img class="footer" src="doxygen.png" alt="doxygen"/>
  523. </a> 1.8.17
  524. </small></address>
  525. </body>
  526. </html>