gnuk/ChibiOS_2.0.6/docs/html/group__registry.html

230 lines
14 KiB
HTML
Raw Normal View History

2010-08-10 03:11:02 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChibiOS/RT: Registry</title>
<link href="custom.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<table style="text-align: center; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 80px;"><img alt="ChibiOS/RT Logo" src="logo_small.png"></td>
<td><big><big>ChibiOS/RT</big></big><br><br>Architecture - Reference Manual - Guides</td>
<td style="width: 80px;"></td>
</tr>
</tbody>
</table>
<hr size="1">
2010-11-22 05:53:37 +00:00
<!-- Generated by Doxygen 1.7.1 -->
2010-08-10 03:11:02 +00:00
<div class="navigation" id="top">
<div class="tabs">
2010-11-22 05:53:37 +00:00
<ul class="tablist">
2010-08-10 03:11:02 +00:00
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
2010-11-22 05:53:37 +00:00
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
2010-08-10 03:11:02 +00:00
<h1>Registry<br/>
<small>
[<a class="el" href="group__kernel.html">Kernel</a>]</small>
2010-11-22 05:53:37 +00:00
</h1> </div>
</div>
<div class="contents">
2010-08-10 03:11:02 +00:00
<p><div class="dynheader">
Collaboration diagram for Registry:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<center><table><tr><td><img src="group__registry.png" border="0" alt="" usemap="#group____registry"/>
<map name="group____registry" id="group____registry">
<area shape="rect" id="node2" href="group__kernel.html" title="Kernel" alt="" coords="5,5,59,32"/> </map>
</td></tr></table></center>
2010-08-10 03:11:02 +00:00
</div>
</p>
<hr/><a name="_details"></a><h2>Description</h2>
<p>Threads Registry related APIs and services.</p>
<h2>Operation mode</h2>
<p>The Threads Registry is a double linked list that holds all the active threads in the system.<br/>
Operations defined for the registry:</p>
<ul>
<li><b>First</b>, returns the first, in creation order, active thread in the system.</li>
<li><b>Next</b>, returns the next, in creation order, active thread in the system.</li>
</ul>
<p>The registry is meant to be mainly a debug feature, as example, using the registry a debugger can enumerate the active threads in any given moment or the shell can print the active threads and their state.<br/>
Another possible use is for centralized threads memory management, terminating threads can pulse an event source and an event handler can perform a scansion of the registry in order to recover the memory.<br/>
In order to use the threads registry the <code>CH_USE_REGISTRY</code> option must be enabled in <code><a class="el" href="chconf_8h.html" title="Configuration file template.">chconf.h</a></code>. </p>
2010-11-22 05:53:37 +00:00
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__registry.html#ga472c6eb9a86e5963f452aa78719c92da">REG_REMOVE</a>(tp)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Removes a thread from the registry list. <a href="#ga472c6eb9a86e5963f452aa78719c92da"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__registry.html#ga365d4805b1329b068d9211b680f43388">REG_INSERT</a>(tp)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds a thread to the registry list. <a href="#ga365d4805b1329b068d9211b680f43388"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_thread.html">Thread</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__registry.html#ga55c0a485b40cf4acbfce0dd333f28513">chRegFirstThread</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the first thread in the system. <a href="#ga55c0a485b40cf4acbfce0dd333f28513"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_thread.html">Thread</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__registry.html#gaefff43a49fb7888a596319d67cf01dab">chRegNextThread</a> (<a class="el" href="struct_thread.html">Thread</a> *tp)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the thread next to the specified one. <a href="#gaefff43a49fb7888a596319d67cf01dab"></a><br/></td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ga472c6eb9a86e5963f452aa78719c92da"></a><!-- doxytag: member="chregistry.h::REG_REMOVE" ref="ga472c6eb9a86e5963f452aa78719c92da" args="(tp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define REG_REMOVE</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">tp</td>
2010-08-10 03:11:02 +00:00
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment">{ \
(tp)-&gt;p_older-&gt;p_newer = (tp)-&gt;p_newer; \
(tp)-&gt;p_newer-&gt;p_older = (tp)-&gt;p_older; \
}
</pre></div>
<p>Removes a thread from the registry list. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>This macro is not meant for use in application code.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>tp</em>&nbsp;</td><td>thread to remove from the registry </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chregistry_8h_source.html#l00046">46</a> of file <a class="el" href="chregistry_8h_source.html">chregistry.h</a>.</p>
<p>Referenced by <a class="el" href="group__threads.html#ga24ab3a3a4d70214ee360867a1c3c75ac">chThdExit()</a>.</p>
</div>
</div>
<a class="anchor" id="ga365d4805b1329b068d9211b680f43388"></a><!-- doxytag: member="chregistry.h::REG_INSERT" ref="ga365d4805b1329b068d9211b680f43388" args="(tp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define REG_INSERT</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">tp</td>
2010-08-10 03:11:02 +00:00
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment">{ \
(tp)-&gt;p_newer = (<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *)&amp;<a class="code" href="group__scheduler.html#ga752cd9dbf0dc458b8b532182836ca38d" title="Ready list header.">rlist</a>; \
(tp)-&gt;p_older = <a class="code" href="group__scheduler.html#ga752cd9dbf0dc458b8b532182836ca38d" title="Ready list header.">rlist</a>.<a class="code" href="struct_ready_list.html#a5b122d594ffb1f9e400ef9ee69b7aa12" title="Older registry element.">r_older</a>; \
(tp)-&gt;<a class="code" href="struct_thread.html#ac1e1ab5bfeca96e03971460a9c76ef5c" title="Older registry element.">p_older</a>-&gt;<a class="code" href="struct_thread.html#a735bed4a4185b8fd502c01d7ad491710" title="Newer registry element.">p_newer</a> = <a class="code" href="group__scheduler.html#ga752cd9dbf0dc458b8b532182836ca38d" title="Ready list header.">rlist</a>.<a class="code" href="struct_ready_list.html#a5b122d594ffb1f9e400ef9ee69b7aa12" title="Older registry element.">r_older</a> = (tp); \
}
</pre></div>
<p>Adds a thread to the registry list. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>This macro is not meant for use in application code.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>tp</em>&nbsp;</td><td>thread to add to the registry </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chregistry_8h_source.html#l00057">57</a> of file <a class="el" href="chregistry_8h_source.html">chregistry.h</a>.</p>
<p>Referenced by <a class="el" href="group__threads.html#ga4f6ae58bb3cedfc03aacde6d49e49d35">init_thread()</a>.</p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga55c0a485b40cf4acbfce0dd333f28513"></a><!-- doxytag: member="chregistry.h::chRegFirstThread" ref="ga55c0a485b40cf4acbfce0dd333f28513" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_thread.html">Thread</a> * chRegFirstThread </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the first thread in the system. </p>
<p>Returns the most ancient thread in the system, usually this is the main thread unless it terminated. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>A reference is added to the returned thread in order to make sure it status is not lost. </dd>
<dd>
This function cannot return <code>NULL</code> because there is always at least one thread in the system.</dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A reference to the first thread. </dd></dl>
<p>Definition at line <a class="el" href="chregistry_8c_source.html#l00070">70</a> of file <a class="el" href="chregistry_8c_source.html">chregistry.c</a>.</p>
<p>References <a class="el" href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, <a class="el" href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>, <a class="el" href="struct_thread.html#af86d1da435197d113bc42fe8139a21c5">Thread::p_refs</a>, <a class="el" href="struct_ready_list.html#adaf2a3d936298fdee21396af9cf640c9">ReadyList::r_newer</a>, and <a class="el" href="group__scheduler.html#ga752cd9dbf0dc458b8b532182836ca38d">rlist</a>.</p>
</div>
</div>
<a class="anchor" id="gaefff43a49fb7888a596319d67cf01dab"></a><!-- doxytag: member="chregistry.h::chRegNextThread" ref="gaefff43a49fb7888a596319d67cf01dab" args="(Thread *tp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_thread.html">Thread</a> * chRegNextThread </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_thread.html">Thread</a> *&nbsp;</td>
<td class="paramname"> <em>tp</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the thread next to the specified one. </p>
<p>The reference counter of the specified thread is decremented and the reference counter of the returned thread is incremented.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>tp</em>&nbsp;</td><td>pointer to the thread </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A reference to the next thread. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>NULL</em>&nbsp;</td><td>if there is no next thread. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chregistry_8c_source.html#l00091">91</a> of file <a class="el" href="chregistry_8c_source.html">chregistry.c</a>.</p>
<p>References <a class="el" href="group__debug.html#ga43d50c69eb730d0f024eb832d61f30c9">chDbgAssert</a>, <a class="el" href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, <a class="el" href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>, <a class="el" href="group__threads.html#gaa22f80040cf192015be4607f31a0ac80">chThdRelease()</a>, <a class="el" href="struct_thread.html#a735bed4a4185b8fd502c01d7ad491710">Thread::p_newer</a>, <a class="el" href="struct_thread.html#af86d1da435197d113bc42fe8139a21c5">Thread::p_refs</a>, and <a class="el" href="group__scheduler.html#ga752cd9dbf0dc458b8b532182836ca38d">rlist</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__registry_gaefff43a49fb7888a596319d67cf01dab_cgraph.png" border="0" usemap="#group__registry_gaefff43a49fb7888a596319d67cf01dab_cgraph" alt=""/></div>
<map name="group__registry_gaefff43a49fb7888a596319d67cf01dab_cgraph" id="group__registry_gaefff43a49fb7888a596319d67cf01dab_cgraph">
<area shape="rect" id="node3" href="group__threads.html#gaa22f80040cf192015be4607f31a0ac80" title="Releases a reference to a thread object." alt="" coords="163,31,253,57"/> <area shape="rect" id="node5" href="group__heaps.html#ga0fc553df0138f02e0b233be91e413c79" title="Frees a previously allocated memory block." alt="" coords="303,5,383,32"/> <area shape="rect" id="node7" href="group__pools.html#ga978f8d038e8e981bf9e5a104b81c6cb6" title="Releases (or adds) an object into (to) a memory pool." alt="" coords="305,56,380,83"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
</div>
<hr size="1"><address style="text-align: right;"><small>
2010-11-22 05:53:37 +00:00
Generated on Sun Oct 24 2010 09:40:46 for ChibiOS/RT by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.7.1</small></address>
2010-08-10 03:11:02 +00:00
</body>
</html>