a00013.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
  3. <title>The Protothreads Library 1.4: pt.h File Reference</title>
  4. <link href="doxygen.css" rel="stylesheet" type="text/css">
  5. <link href="tabs.css" rel="stylesheet" type="text/css">
  6. </head><body>
  7. <!-- Generated by Doxygen 1.4.6 -->
  8. <div class="tabs">
  9. <ul>
  10. <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
  11. <li><a href="modules.html"><span>Modules</span></a></li>
  12. <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
  13. <li id="current"><a href="files.html"><span>Files</span></a></li>
  14. </ul></div>
  15. <div class="tabs">
  16. <ul>
  17. <li><a href="files.html"><span>File&nbsp;List</span></a></li>
  18. <li><a href="globals.html"><span>Globals</span></a></li>
  19. </ul></div>
  20. <h1>pt.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
  21. Protothreads implementation.
  22. <p>
  23. <dl compact><dt><b>Author:</b></dt><dd>Adam Dunkels &lt;<a href="mailto:adam@sics.se">adam@sics.se</a>&gt; </dd></dl>
  24. <p>
  25. Definition in file <a class="el" href="a00022.html">pt.h</a>.
  26. <p>
  27. <code>#include &quot;<a class="el" href="a00020.html">lc.h</a>&quot;</code><br>
  28. <p>
  29. <a href="a00022.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
  30. <tr><td></td></tr>
  31. <tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
  32. <tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html">pt</a></td></tr>
  33. <tr><td colspan="2"><br><h2>Initialization</h2></td></tr>
  34. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#ge6bae7dc0225468c8a5ac269df549892">PT_INIT</a>(<a class="el" href="a00005.html">pt</a>)</td></tr>
  35. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize a protothread. <a href="a00014.html#ge6bae7dc0225468c8a5ac269df549892"></a><br></td></tr>
  36. <tr><td colspan="2"><br><h2>Declaration and definition</h2></td></tr>
  37. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g3d4c8bd4aada659eb34f5d2ffd3e7901">PT_THREAD</a>(name_args)</td></tr>
  38. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declaration of a protothread. <a href="a00014.html#g3d4c8bd4aada659eb34f5d2ffd3e7901"></a><br></td></tr>
  39. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g2ffbb9e554e08a343ae2f9de4bedfdfc">PT_BEGIN</a>(<a class="el" href="a00005.html">pt</a>)</td></tr>
  40. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declare the start of a protothread inside the C function implementing the protothread. <a href="a00014.html#g2ffbb9e554e08a343ae2f9de4bedfdfc"></a><br></td></tr>
  41. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g7b04a0035bef29d905496c23bae066d2">PT_END</a>(<a class="el" href="a00005.html">pt</a>)</td></tr>
  42. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declare the end of a protothread. <a href="a00014.html#g7b04a0035bef29d905496c23bae066d2"></a><br></td></tr>
  43. <tr><td colspan="2"><br><h2>Blocked wait</h2></td></tr>
  44. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g99e43010ec61327164466aa2d902de45">PT_WAIT_UNTIL</a>(<a class="el" href="a00005.html">pt</a>, condition)</td></tr>
  45. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Block and wait until condition is true. <a href="a00014.html#g99e43010ec61327164466aa2d902de45"></a><br></td></tr>
  46. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#gad14bbbf092b90aa0a5a4f9169504a8d">PT_WAIT_WHILE</a>(<a class="el" href="a00005.html">pt</a>, cond)</td></tr>
  47. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Block and wait while condition is true. <a href="a00014.html#gad14bbbf092b90aa0a5a4f9169504a8d"></a><br></td></tr>
  48. <tr><td colspan="2"><br><h2>Hierarchical protothreads</h2></td></tr>
  49. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g2f8f70c30b9ee08a103fbd69a4365c4c">PT_WAIT_THREAD</a>(<a class="el" href="a00005.html">pt</a>, thread)</td></tr>
  50. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Block and wait until a child protothread completes. <a href="a00014.html#g2f8f70c30b9ee08a103fbd69a4365c4c"></a><br></td></tr>
  51. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g9e97a0b4d5cc7764d8e19758f5da53ae">PT_SPAWN</a>(<a class="el" href="a00005.html">pt</a>, child, thread)</td></tr>
  52. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Spawn a child protothread and wait until it exits. <a href="a00014.html#g9e97a0b4d5cc7764d8e19758f5da53ae"></a><br></td></tr>
  53. <tr><td colspan="2"><br><h2>Exiting and restarting</h2></td></tr>
  54. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#gcd3ac045f0a4ae63412e3b3d8780e8ab">PT_RESTART</a>(<a class="el" href="a00005.html">pt</a>)</td></tr>
  55. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Restart the protothread. <a href="a00014.html#gcd3ac045f0a4ae63412e3b3d8780e8ab"></a><br></td></tr>
  56. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g905451249dca72ce0385bf2a9ff178ee">PT_EXIT</a>(<a class="el" href="a00005.html">pt</a>)</td></tr>
  57. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Exit the protothread. <a href="a00014.html#g905451249dca72ce0385bf2a9ff178ee"></a><br></td></tr>
  58. <tr><td colspan="2"><br><h2>Calling a protothread</h2></td></tr>
  59. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#gfa82b860a64b67d25ab3abc21811896f">PT_SCHEDULE</a>(f)</td></tr>
  60. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Schedule a protothread. <a href="a00014.html#gfa82b860a64b67d25ab3abc21811896f"></a><br></td></tr>
  61. <tr><td colspan="2"><br><h2>Yielding from a protothread</h2></td></tr>
  62. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g155cba6121323726d02c00284428fed6">PT_YIELD</a>(<a class="el" href="a00005.html">pt</a>)</td></tr>
  63. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Yield from the current protothread. <a href="a00014.html#g155cba6121323726d02c00284428fed6"></a><br></td></tr>
  64. <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#ge3c821e3a388615528efda9d23c7d115">PT_YIELD_UNTIL</a>(<a class="el" href="a00005.html">pt</a>, cond)</td></tr>
  65. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Yield from the protothread until a condition occurs. <a href="a00014.html#ge3c821e3a388615528efda9d23c7d115"></a><br></td></tr>
  66. <tr><td colspan="2"><br><h2>Defines</h2></td></tr>
  67. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g7b5319b5b65761a845fcd1500fde4cdc"></a><!-- doxytag: member="pt.h::PT_WAITING" ref="g7b5319b5b65761a845fcd1500fde4cdc" args="" -->
  68. #define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g7b5319b5b65761a845fcd1500fde4cdc">PT_WAITING</a>&nbsp;&nbsp;&nbsp;0</td></tr>
  69. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ge469332907e0617d72d5e2dd4297119d"></a><!-- doxytag: member="pt.h::PT_YIELDED" ref="ge469332907e0617d72d5e2dd4297119d" args="" -->
  70. #define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#ge469332907e0617d72d5e2dd4297119d">PT_YIELDED</a>&nbsp;&nbsp;&nbsp;1</td></tr>
  71. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gcfae9053e5c107a1aed6b228c917d2ea"></a><!-- doxytag: member="pt.h::PT_EXITED" ref="gcfae9053e5c107a1aed6b228c917d2ea" args="" -->
  72. #define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#gcfae9053e5c107a1aed6b228c917d2ea">PT_EXITED</a>&nbsp;&nbsp;&nbsp;2</td></tr>
  73. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g9ff1e8936a8a26bff54c05f8a989b93b"></a><!-- doxytag: member="pt.h::PT_ENDED" ref="g9ff1e8936a8a26bff54c05f8a989b93b" args="" -->
  74. #define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00014.html#g9ff1e8936a8a26bff54c05f8a989b93b">PT_ENDED</a>&nbsp;&nbsp;&nbsp;3</td></tr>
  75. </table>
  76. <hr size="1"><address style="align: right;"><small>Generated on Mon Oct 2 10:06:29 2006 for The Protothreads Library 1.4 by&nbsp;
  77. <a href="http://www.doxygen.org/index.html">
  78. <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
  79. </body>
  80. </html>