📄 group__mutex.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>YAVRTOS: Mutexes</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.4 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul></div><h1>Mutexes</h1><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#gdff77e0b451c30c07d2990e669f937c5">lock_on</a> (<a class="el" href="structmutex__t.html">mutex_t</a> *m)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Lock on a mutex. <a href="#gdff77e0b451c30c07d2990e669f937c5"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__mutex.html#g327f419711064b7407f6f47011221cc4">lock_off</a> (<a class="el" href="structmutex__t.html">mutex_t</a> *m)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Unlock a mutex. <a href="#g327f419711064b7407f6f47011221cc4"></a><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>A <b>MUT</b>ual <b>EX</b>clusion object - only one task can "own" a mutex at any one time.<p>Mutexes are "owned" by calling <a class="el" href="group__mutex.html#gdff77e0b451c30c07d2990e669f937c5" title="Lock on a mutex.">lock_on()</a>, and released by calling <a class="el" href="group__mutex.html#g327f419711064b7407f6f47011221cc4" title="Unlock a mutex.">lock_off()</a><p>If another task tries to own an "owned" mutex, that task will be suspended until the mutex becomes available.<p>Tasks may own as many mutexes as they wish, and mutexes will automatically be released when the task exits<p>See <a class="el" href="usage-mutex.html">using mutexes</a> for information on how to use mutexes<p>If malloc() is going to be used by your task, then you may require a mutex for the microcontroller memory - see <a class="el" href="howdoi.html#malloc">How do I use malloc() and free() safely?</a> <hr><h2>Function Documentation</h2><a class="anchor" name="g327f419711064b7407f6f47011221cc4"></a><!-- doxytag: member="task.h::lock_off" ref="g327f419711064b7407f6f47011221cc4" args="(mutex_t *m)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">uint8_t lock_off </td> <td>(</td> <td class="paramtype"><a class="el" href="structmutex__t.html">mutex_t</a> * </td> <td class="paramname"> <em>m</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Unlock a mutex. <p>This function can only usefully be called by the task that locked the mutex in the first place, and it may end up yielding control to a task that is waiting on the mutex. The return value is zero for success.<p>Note that if someone has called <a class="el" href="group__task.html#ge1337adc1d63d7cd874a376d6513c04a" title="Stop a task.">stop_task()</a> on this task with the <code>wait_for_mutexes</code> parameter set, and if the call to this function is the one that releases the tasks' last mutex, then this function won't "return" - the <a class="el" href="task_8c.html#b1c4cc247bd379e340e25bd86911919d" title="The entry point for all tasks that are stopping">task_stopper()</a> will run on this task instead. </div></div><p><a class="anchor" name="gdff77e0b451c30c07d2990e669f937c5"></a><!-- doxytag: member="task.h::lock_on" ref="gdff77e0b451c30c07d2990e669f937c5" args="(mutex_t *m)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">uint8_t lock_on </td> <td>(</td> <td class="paramtype"><a class="el" href="structmutex__t.html">mutex_t</a> * </td> <td class="paramname"> <em>m</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Lock on a mutex. <p>The return value is zero for success.<p>Since the task may be suspended while waiting for another task to release the mutex, this function may only be called by tasks with a non-zero priority. </div></div><p><hr><p align="center"><font size="-1">YAVRTOS and YAVRTOS documentation Copyright © 2007-2008 Chris O'Byrne. Email - chris <at> obyrne <dot> com</font></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -