wut/group__coreinit__semaphore.html
2016-01-11 01:17:32 +00:00

294 lines
14 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.10"/>
<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>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</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">0.1</span>
</div>
<div id="projectbrief">Wii U Toolchain</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</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:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_o_s_semaphore.html">OSSemaphore</a></td></tr>
<tr class="separator:"><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="struct_o_s_semaphore.html">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="struct_o_s_semaphore.html">OSSemaphore</a> *semaphore, int32_t count)</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="struct_o_s_semaphore.html">OSSemaphore</a> *semaphore, int32_t count, const char *name)</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="struct_o_s_semaphore.html">OSSemaphore</a> *semaphore)</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="struct_o_s_semaphore.html">OSSemaphore</a> *semaphore)</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="struct_o_s_semaphore.html">OSSemaphore</a> *semaphore)</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="struct_o_s_semaphore.html">OSSemaphore</a> *semaphore)</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>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ga888ed45dfac53be5a7023823c826ed64"></a>
<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>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 class="anchor" id="ga46989e5d6706438811f38e7b76e803a7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="struct_o_s_semaphore.html">OSSemaphore</a> <a class="el" href="struct_o_s_semaphore.html">OSSemaphore</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>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 class="anchor" id="gaf135af1869002a8137894aabbbd061b1"></a>
<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="struct_o_s_semaphore.html">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 class="anchor" id="gad4af5a89ce56153ce57b9145f2e51e0a"></a>
<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="struct_o_s_semaphore.html">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 class="anchor" id="gac520cef5f6f40bbd3f917b486d9fec33"></a>
<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="struct_o_s_semaphore.html">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 class="anchor" id="ga5a1ba1984a871044aa31ff0f40d52806"></a>
<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="struct_o_s_semaphore.html">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 class="anchor" id="ga02e41ca9da26f52a7c3867531e2711ac"></a>
<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="struct_o_s_semaphore.html">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 class="anchor" id="ga289bfdb3843d8615c365e91d196f008b"></a>
<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="struct_o_s_semaphore.html">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.10
</small></address>
</body>
</html>