wut/group__coreinit__semaphore.html
2020-03-26 16:49:18 +11:00

352 lines
18 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>wut: Semaphore</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">wut
&#160;<span id="projectnumber">1.0.0-beta9</span>
</div>
<div id="projectbrief">Wii U Toolchain</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Semaphore<div class="ingroups"><a class="el" href="group__coreinit.html">coreinit</a></div></div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structOSSemaphore"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a></td></tr>
<tr class="separator:structOSSemaphore"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga888ed45dfac53be5a7023823c826ed64"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#ga888ed45dfac53be5a7023823c826ed64">OS_SEMAPHORE_TAG</a>&#160;&#160;&#160;0x73506852u</td></tr>
<tr class="separator:ga888ed45dfac53be5a7023823c826ed64"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga46989e5d6706438811f38e7b76e803a7"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#ga46989e5d6706438811f38e7b76e803a7">OSSemaphore</a></td></tr>
<tr class="separator:ga46989e5d6706438811f38e7b76e803a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaf135af1869002a8137894aabbbd061b1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#gaf135af1869002a8137894aabbbd061b1">OSInitSemaphore</a> (<a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *semaphore, int32_t count)</td></tr>
<tr class="memdesc:gaf135af1869002a8137894aabbbd061b1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialise semaphore object with count. <a href="group__coreinit__semaphore.html#gaf135af1869002a8137894aabbbd061b1">More...</a><br /></td></tr>
<tr class="separator:gaf135af1869002a8137894aabbbd061b1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad4af5a89ce56153ce57b9145f2e51e0a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#gad4af5a89ce56153ce57b9145f2e51e0a">OSInitSemaphoreEx</a> (<a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *semaphore, int32_t count, const char *name)</td></tr>
<tr class="memdesc:gad4af5a89ce56153ce57b9145f2e51e0a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialise semaphore object with count and name. <a href="group__coreinit__semaphore.html#gad4af5a89ce56153ce57b9145f2e51e0a">More...</a><br /></td></tr>
<tr class="separator:gad4af5a89ce56153ce57b9145f2e51e0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac520cef5f6f40bbd3f917b486d9fec33"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#gac520cef5f6f40bbd3f917b486d9fec33">OSGetSemaphoreCount</a> (<a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *semaphore)</td></tr>
<tr class="memdesc:gac520cef5f6f40bbd3f917b486d9fec33"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the current semaphore count. <a href="group__coreinit__semaphore.html#gac520cef5f6f40bbd3f917b486d9fec33">More...</a><br /></td></tr>
<tr class="separator:gac520cef5f6f40bbd3f917b486d9fec33"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5a1ba1984a871044aa31ff0f40d52806"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#ga5a1ba1984a871044aa31ff0f40d52806">OSSignalSemaphore</a> (<a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *semaphore)</td></tr>
<tr class="memdesc:ga5a1ba1984a871044aa31ff0f40d52806"><td class="mdescLeft">&#160;</td><td class="mdescRight">Increase the semaphore value. <a href="group__coreinit__semaphore.html#ga5a1ba1984a871044aa31ff0f40d52806">More...</a><br /></td></tr>
<tr class="separator:ga5a1ba1984a871044aa31ff0f40d52806"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga02e41ca9da26f52a7c3867531e2711ac"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#ga02e41ca9da26f52a7c3867531e2711ac">OSWaitSemaphore</a> (<a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *semaphore)</td></tr>
<tr class="memdesc:ga02e41ca9da26f52a7c3867531e2711ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decrease the semaphore value. <a href="group__coreinit__semaphore.html#ga02e41ca9da26f52a7c3867531e2711ac">More...</a><br /></td></tr>
<tr class="separator:ga02e41ca9da26f52a7c3867531e2711ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga289bfdb3843d8615c365e91d196f008b"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__coreinit__semaphore.html#ga289bfdb3843d8615c365e91d196f008b">OSTryWaitSemaphore</a> (<a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *semaphore)</td></tr>
<tr class="memdesc:ga289bfdb3843d8615c365e91d196f008b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Try to decrease the semaphore value. <a href="group__coreinit__semaphore.html#ga289bfdb3843d8615c365e91d196f008b">More...</a><br /></td></tr>
<tr class="separator:ga289bfdb3843d8615c365e91d196f008b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Similar to Windows <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms685129(v=vs.85).aspx">Semaphore Objects</a>. </p>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structOSSemaphore" id="structOSSemaphore"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structOSSemaphore">&#9670;&nbsp;</a></span>OSSemaphore</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct OSSemaphore</td>
</tr>
</table>
</div><div class="memdoc">
<div class="textblock">
<p class="definition">Definition at line <a class="el" href="semaphore_8h_source.html#l00021">21</a> of file <a class="el" href="semaphore_8h_source.html">semaphore.h</a>.</p>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a1c50fcd1195659821729f52af8f3bb7d"></a>uint32_t</td>
<td class="fieldname">
tag</td>
<td class="fielddoc">
Should always be set to the value OS_SEMAPHORE_TAG. </td></tr>
<tr><td class="fieldtype">
<a id="a8f8f80d37794cde9472343e4487ba3eb"></a>const char *</td>
<td class="fieldname">
name</td>
<td class="fielddoc">
Name set by OSInitMutexEx. </td></tr>
<tr><td class="fieldtype">
<a id="a4858b400f708a13bd514376ab941b27d"></a>int32_t</td>
<td class="fieldname">
count</td>
<td class="fielddoc">
Current count of semaphore. </td></tr>
<tr><td class="fieldtype">
<a id="a4c72ffd2d6a41665aa8203649acbb46d"></a><a class="el" href="group__coreinit__threadq.html#structOSThreadQueue">OSThreadQueue</a></td>
<td class="fieldname">
queue</td>
<td class="fielddoc">
Queue of threads waiting on semaphore object with OSWaitSemaphore. </td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga888ed45dfac53be5a7023823c826ed64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga888ed45dfac53be5a7023823c826ed64">&#9670;&nbsp;</a></span>OS_SEMAPHORE_TAG</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define OS_SEMAPHORE_TAG&#160;&#160;&#160;0x73506852u</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="semaphore_8h_source.html#l00019">19</a> of file <a class="el" href="semaphore_8h_source.html">semaphore.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ga46989e5d6706438811f38e7b76e803a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga46989e5d6706438811f38e7b76e803a7">&#9670;&nbsp;</a></span>OSSemaphore</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> <a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="semaphore_8h_source.html#l00017">17</a> of file <a class="el" href="semaphore_8h_source.html">semaphore.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaf135af1869002a8137894aabbbd061b1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf135af1869002a8137894aabbbd061b1">&#9670;&nbsp;</a></span>OSInitSemaphore()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void OSInitSemaphore </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *&#160;</td>
<td class="paramname"><em>semaphore</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>count</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialise semaphore object with count. </p>
</div>
</div>
<a id="gad4af5a89ce56153ce57b9145f2e51e0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad4af5a89ce56153ce57b9145f2e51e0a">&#9670;&nbsp;</a></span>OSInitSemaphoreEx()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void OSInitSemaphoreEx </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *&#160;</td>
<td class="paramname"><em>semaphore</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>name</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialise semaphore object with count and name. </p>
</div>
</div>
<a id="gac520cef5f6f40bbd3f917b486d9fec33"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac520cef5f6f40bbd3f917b486d9fec33">&#9670;&nbsp;</a></span>OSGetSemaphoreCount()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t OSGetSemaphoreCount </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *&#160;</td>
<td class="paramname"><em>semaphore</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the current semaphore count. </p>
</div>
</div>
<a id="ga5a1ba1984a871044aa31ff0f40d52806"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5a1ba1984a871044aa31ff0f40d52806">&#9670;&nbsp;</a></span>OSSignalSemaphore()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t OSSignalSemaphore </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *&#160;</td>
<td class="paramname"><em>semaphore</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Increase the semaphore value. </p>
<p>If any threads are waiting for semaphore, they are woken. </p>
</div>
</div>
<a id="ga02e41ca9da26f52a7c3867531e2711ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga02e41ca9da26f52a7c3867531e2711ac">&#9670;&nbsp;</a></span>OSWaitSemaphore()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t OSWaitSemaphore </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *&#160;</td>
<td class="paramname"><em>semaphore</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Decrease the semaphore value. </p>
<p>If the value is less than or equal to zero the current thread will be put to sleep until the count is above zero and it can decrement it safely. </p>
</div>
</div>
<a id="ga289bfdb3843d8615c365e91d196f008b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga289bfdb3843d8615c365e91d196f008b">&#9670;&nbsp;</a></span>OSTryWaitSemaphore()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t OSTryWaitSemaphore </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coreinit__semaphore.html#structOSSemaphore">OSSemaphore</a> *&#160;</td>
<td class="paramname"><em>semaphore</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Try to decrease the semaphore value. </p>
<p>If the value is greater than zero then it will be decremented, else the function will return immediately with a value &lt;= 0 indicating a failure.</p>
<dl class="section return"><dt>Returns</dt><dd>Returns previous semaphore count, before the decrement in this function. If the value is &gt;0 then it means the call was succesful. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>