Files
moslab-code/doc/source/html/structL4_1_1Semaphore.html
2025-09-12 15:55:45 +02:00

303 lines
31 KiB
HTML

<!-- HTML header for doxygen 1.9.1-->
<!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.15.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>L4Re Operating System Framework: L4::Semaphore Struct Reference</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.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" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="l4re-awesome.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="projectlogo"><img alt="Logo" src="L4Re_rgb_logo_quer_hg_h55.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">L4Re Operating System Framework
</div>
<div id="projectbrief">Interface and Usage Documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.15.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(function(){initNavTree('structL4_1_1Semaphore.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">L4::Semaphore Struct Reference</div></div>
</div><!--header-->
<div class="contents">
<p>C++ Kernel-provided semaphore interface, see <a class="el" href="group__l4__semaphore__api.html">Kernel-provided semaphore</a> for the C interface.
<a href="#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="semaphore_source.html">semaphore</a>&gt;</code></p>
<div id="dynsection-0" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Inheritance diagram for L4::Semaphore:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="structL4_1_1Semaphore__inherit__graph.svg" width="452" height="756"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div id="dynsection-1" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Collaboration diagram for L4::Semaphore:</div>
<div id="dynsection-1-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-1-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="structL4_1_1Semaphore__coll__graph.svg" width="452" height="756"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pub-methods" class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3de7e4e35ff4dadab9a26f3b87fb76bc" id="r_a3de7e4e35ff4dadab9a26f3b87fb76bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structl4__msgtag__t.html">l4_msgtag_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3de7e4e35ff4dadab9a26f3b87fb76bc">up</a> (<a class="el" href="group__l4__utcb__api.html#ga89be8a86d11c1d532b636cc2df1330fb">l4_utcb_t</a> *utcb=<a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644">l4_utcb</a>()) noexcept</td></tr>
<tr class="memdesc:a3de7e4e35ff4dadab9a26f3b87fb76bc"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="structL4_1_1Semaphore.html" title="C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.">Semaphore</a> up operation (wrapper for <a class="el" href="structL4_1_1Triggerable.html#a7109ca8b4aeac0169639f973c91a3a6b" title="Trigger the object.">trigger()</a>). <br /></td></tr>
<tr class="memitem:a5db9d69c03c135a9ae92d8a523cd9a4c" id="r_a5db9d69c03c135a9ae92d8a523cd9a4c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structl4__msgtag__t.html">l4_msgtag_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5db9d69c03c135a9ae92d8a523cd9a4c">down</a> (<a class="el" href="unionl4__timeout__t.html">l4_timeout_t</a> timeout=<a class="el" href="group__l4__timeout__api.html#gaf01c5e1475efc4f33bc7d1985f7320d3">L4_IPC_NEVER</a>, <a class="el" href="group__l4__utcb__api.html#ga89be8a86d11c1d532b636cc2df1330fb">l4_utcb_t</a> *utcb=<a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644">l4_utcb</a>()) noexcept</td></tr>
<tr class="memdesc:a5db9d69c03c135a9ae92d8a523cd9a4c"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="structL4_1_1Semaphore.html" title="C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.">Semaphore</a> down operation. <br /></td></tr>
<tr class="inherit_header pub_methods_structL4_1_1Triggerable"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pub_methods_structL4_1_1Triggerable')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Public Member Functions inherited from <a class="el" href="structL4_1_1Triggerable.html">L4::Triggerable</a></td></tr>
<tr class="memitem:a7109ca8b4aeac0169639f973c91a3a6b inherit pub_methods_structL4_1_1Triggerable" id="r_a7109ca8b4aeac0169639f973c91a3a6b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structl4__msgtag__t.html">l4_msgtag_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structL4_1_1Triggerable.html#a7109ca8b4aeac0169639f973c91a3a6b">trigger</a> (<a class="el" href="group__l4__utcb__api.html#ga89be8a86d11c1d532b636cc2df1330fb">l4_utcb_t</a> *utcb=<a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644">l4_utcb</a>()) noexcept</td></tr>
<tr class="memdesc:a7109ca8b4aeac0169639f973c91a3a6b inherit pub_methods_structL4_1_1Triggerable"><td class="mdescLeft">&#160;</td><td class="mdescRight">Trigger the object. <br /></td></tr>
<tr class="inherit_header pub_methods_classL4_1_1Irq__eoi"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pub_methods_classL4_1_1Irq__eoi')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Public Member Functions inherited from <a class="el" href="classL4_1_1Irq__eoi.html">L4::Irq_eoi</a></td></tr>
<tr class="memitem:a2143eb2495d0135bc432efc362845483 inherit pub_methods_classL4_1_1Irq__eoi" id="r_a2143eb2495d0135bc432efc362845483"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structl4__msgtag__t.html">l4_msgtag_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classL4_1_1Irq__eoi.html#a2143eb2495d0135bc432efc362845483">unmask</a> (unsigned irqnum, <a class="el" href="group__l4__basic__types.html#ga1c2c4b333f75b1d05b59855910f2b9cb">l4_umword_t</a> *label=0, <a class="el" href="unionl4__timeout__t.html">l4_timeout_t</a> to=<a class="el" href="group__l4__timeout__api.html#gaf01c5e1475efc4f33bc7d1985f7320d3">L4_IPC_NEVER</a>, <a class="el" href="group__l4__utcb__api.html#ga89be8a86d11c1d532b636cc2df1330fb">l4_utcb_t</a> *utcb=<a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644">l4_utcb</a>()) noexcept</td></tr>
<tr class="memdesc:a2143eb2495d0135bc432efc362845483 inherit pub_methods_classL4_1_1Irq__eoi"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unmask the given interrupt line. <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-inherited" class="groupheader"><a id="inherited" name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_types_classL4_1_1Kobject__t"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pro_types_classL4_1_1Kobject__t')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Protected Types inherited from <a class="el" href="classL4_1_1Kobject__t.html">L4::Kobject_t&lt; Semaphore, Triggerable, L4_PROTO_SEMAPHORE &gt;</a></td></tr>
<tr class="memitem:af7df35ba5bf68ef5993e605a6b62328a inherit pro_types_classL4_1_1Kobject__t" id="r_af7df35ba5bf68ef5993e605a6b62328a"><td class="memItemLeft" align="right" valign="top">
typedef <a class="el" href="structL4_1_1Semaphore.html">Semaphore</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Class</b></td></tr>
<tr class="memdesc:af7df35ba5bf68ef5993e605a6b62328a inherit pro_types_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">The target interface type (inheriting from <a class="el" href="classL4_1_1Kobject__t.html" title="Helper class to create an L4Re interface class that is derived from a single base class.">Kobject_t</a>). <br /></td></tr>
<tr class="memitem:a0d83157994565e9c01f10006bdda2efa inherit pro_types_classL4_1_1Kobject__t" id="r_a0d83157994565e9c01f10006bdda2efa"><td class="memItemLeft" align="right" valign="top">
typedef Typeid::Iface&lt; PROTO, <a class="el" href="structL4_1_1Semaphore.html">Semaphore</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>__Iface</b></td></tr>
<tr class="memdesc:a0d83157994565e9c01f10006bdda2efa inherit pro_types_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">The interface description for the derived class. <br /></td></tr>
<tr class="memitem:afc2feec2f4a15e85286aabfa15c53e06 inherit pro_types_classL4_1_1Kobject__t" id="r_afc2feec2f4a15e85286aabfa15c53e06"><td class="memItemLeft" align="right" valign="top">
typedef Typeid::Merge_list&lt; Typeid::Iface_list&lt; <a class="el" href="classL4_1_1Kobject__t.html#a0d83157994565e9c01f10006bdda2efa">__Iface</a> &gt;, typename Triggerable::__Iface_list &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>__Iface_list</b></td></tr>
<tr class="memdesc:afc2feec2f4a15e85286aabfa15c53e06 inherit pro_types_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">The list of all RPC interfaces provided directly or through inheritance. <br /></td></tr>
<tr class="inherit_header pro_types_classL4_1_1Kobject__t"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pro_types_classL4_1_1Kobject__t')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Protected Types inherited from <a class="el" href="classL4_1_1Kobject__t.html">L4::Kobject_t&lt; Triggerable, Irq_eoi, L4_PROTO_IRQ &gt;</a></td></tr>
<tr class="memitem:af7df35ba5bf68ef5993e605a6b62328a inherit pro_types_classL4_1_1Kobject__t" id="r_af7df35ba5bf68ef5993e605a6b62328a"><td class="memItemLeft" align="right" valign="top">
typedef <a class="el" href="structL4_1_1Triggerable.html">Triggerable</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Class</b></td></tr>
<tr class="memdesc:af7df35ba5bf68ef5993e605a6b62328a inherit pro_types_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">The target interface type (inheriting from <a class="el" href="classL4_1_1Kobject__t.html" title="Helper class to create an L4Re interface class that is derived from a single base class.">Kobject_t</a>). <br /></td></tr>
<tr class="memitem:a0d83157994565e9c01f10006bdda2efa inherit pro_types_classL4_1_1Kobject__t" id="r_a0d83157994565e9c01f10006bdda2efa"><td class="memItemLeft" align="right" valign="top">
typedef Typeid::Iface&lt; PROTO, <a class="el" href="structL4_1_1Triggerable.html">Triggerable</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>__Iface</b></td></tr>
<tr class="memdesc:a0d83157994565e9c01f10006bdda2efa inherit pro_types_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">The interface description for the derived class. <br /></td></tr>
<tr class="memitem:afc2feec2f4a15e85286aabfa15c53e06 inherit pro_types_classL4_1_1Kobject__t" id="r_afc2feec2f4a15e85286aabfa15c53e06"><td class="memItemLeft" align="right" valign="top">
typedef Typeid::Merge_list&lt; Typeid::Iface_list&lt; <a class="el" href="classL4_1_1Kobject__t.html#a0d83157994565e9c01f10006bdda2efa">__Iface</a> &gt;, typename Irq_eoi::__Iface_list &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>__Iface_list</b></td></tr>
<tr class="memdesc:afc2feec2f4a15e85286aabfa15c53e06 inherit pro_types_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">The list of all RPC interfaces provided directly or through inheritance. <br /></td></tr>
<tr class="inherit_header pro_methods_classL4_1_1Kobject__t"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pro_methods_classL4_1_1Kobject__t')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Protected Member Functions inherited from <a class="el" href="classL4_1_1Kobject__t.html">L4::Kobject_t&lt; Semaphore, Triggerable, L4_PROTO_SEMAPHORE &gt;</a></td></tr>
<tr class="memitem:a3d80fec7e057d575ec4b393437f05f8a inherit pro_methods_classL4_1_1Kobject__t" id="r_a3d80fec7e057d575ec4b393437f05f8a"><td class="memItemLeft" align="right" valign="top">
<a class="el" href="classL4_1_1Cap.html">L4::Cap</a>&lt; <a class="el" href="classL4_1_1Kobject__t.html#af7df35ba5bf68ef5993e605a6b62328a">Class</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>c</b> () const noexcept</td></tr>
<tr class="memdesc:a3d80fec7e057d575ec4b393437f05f8a inherit pro_methods_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the capability to ourselves. <br /></td></tr>
<tr class="inherit_header pro_methods_classL4_1_1Kobject__t"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pro_methods_classL4_1_1Kobject__t')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Protected Member Functions inherited from <a class="el" href="classL4_1_1Kobject__t.html">L4::Kobject_t&lt; Triggerable, Irq_eoi, L4_PROTO_IRQ &gt;</a></td></tr>
<tr class="memitem:a3d80fec7e057d575ec4b393437f05f8a inherit pro_methods_classL4_1_1Kobject__t" id="r_a3d80fec7e057d575ec4b393437f05f8a"><td class="memItemLeft" align="right" valign="top">
<a class="el" href="classL4_1_1Cap.html">L4::Cap</a>&lt; <a class="el" href="classL4_1_1Kobject__t.html#af7df35ba5bf68ef5993e605a6b62328a">Class</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>c</b> () const noexcept</td></tr>
<tr class="memdesc:a3d80fec7e057d575ec4b393437f05f8a inherit pro_methods_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the capability to ourselves. <br /></td></tr>
<tr class="inherit_header pro_static_methods_classL4_1_1Kobject__t"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pro_static_methods_classL4_1_1Kobject__t')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Static Protected Member Functions inherited from <a class="el" href="classL4_1_1Kobject__t.html">L4::Kobject_t&lt; Semaphore, Triggerable, L4_PROTO_SEMAPHORE &gt;</a></td></tr>
<tr class="memitem:a7433b8eed587278821dd496864f75363 inherit pro_static_methods_classL4_1_1Kobject__t" id="r_a7433b8eed587278821dd496864f75363"><td class="memItemLeft" align="right" valign="top">
static void&#160;</td><td class="memItemRight" valign="bottom"><b>__check_protocols__</b> () noexcept</td></tr>
<tr class="memdesc:a7433b8eed587278821dd496864f75363 inherit pro_static_methods_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper to check for protocol conflicts. <br /></td></tr>
<tr class="inherit_header pro_static_methods_classL4_1_1Kobject__t"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pro_static_methods_classL4_1_1Kobject__t')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Static Protected Member Functions inherited from <a class="el" href="classL4_1_1Kobject__t.html">L4::Kobject_t&lt; Triggerable, Irq_eoi, L4_PROTO_IRQ &gt;</a></td></tr>
<tr class="memitem:a7433b8eed587278821dd496864f75363 inherit pro_static_methods_classL4_1_1Kobject__t" id="r_a7433b8eed587278821dd496864f75363"><td class="memItemLeft" align="right" valign="top">
static void&#160;</td><td class="memItemRight" valign="bottom"><b>__check_protocols__</b> () noexcept</td></tr>
<tr class="memdesc:a7433b8eed587278821dd496864f75363 inherit pro_static_methods_classL4_1_1Kobject__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper to check for protocol conflicts. <br /></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><p>C++ Kernel-provided semaphore interface, see <a class="el" href="group__l4__semaphore__api.html">Kernel-provided semaphore</a> for the C interface. </p>
<p>This is the interface for kernel-provided semaphore objects. The object provides the classical functions <span class="tt"><a class="el" href="#a3de7e4e35ff4dadab9a26f3b87fb76bc" title="Semaphore up operation (wrapper for trigger()).">up()</a></span> and <span class="tt"><a class="el" href="#a5db9d69c03c135a9ae92d8a523cd9a4c" title="Semaphore down operation.">down()</a></span> for counting the semaphore and blocking. The semaphore is a <a class="el" href="structL4_1_1Triggerable.html" title="Interface that allows an object to be triggered by some source.">Triggerable</a> with respect to the <span class="tt"><a class="el" href="#a3de7e4e35ff4dadab9a26f3b87fb76bc" title="Semaphore up operation (wrapper for trigger()).">up()</a></span> function, this means that a semaphore can be bound to an interrupt line at an ICU (<a class="el" href="classL4_1_1Icu.html" title="C++ Icu interface, see Interrupt controller for the C interface.">L4::Icu</a>) and incoming interrupts increment the semaphore counter.</p>
<p>The <span class="tt"><a class="el" href="#a5db9d69c03c135a9ae92d8a523cd9a4c" title="Semaphore down operation.">down()</a></span> method decrements the semaphore counter and blocks if the counter is already zero. Blocking on a semaphore may&mdash;as all blocking operations&mdash;either return successfully, or be aborted due to an expired timeout provided to the <span class="tt"><a class="el" href="#a5db9d69c03c135a9ae92d8a523cd9a4c" title="Semaphore down operation.">down()</a></span> operation, or due to an <a class="el" href="classL4_1_1Thread.html#aacd56bbf983577cfc591f21fd511d3b6" title="Exchange basic thread registers.">L4::Thread::ex_regs()</a> operation with the <a class="el" href="group__l4__thread__api.html#gga288a4500e4be2587d2f16d754d1a2e16aa13ff4d1b899982508b9ad36c61fe47a" title="Cancel ongoing IPC in the thread.">L4_THREAD_EX_REGS_CANCEL</a> flag set.</p>
<p>A semaphore object is initialized with counter value 0.</p>
<p>The main reason for using a semaphore instead of an <a class="el" href="classL4_1_1Irq.html" title="C++ Irq interface, see IRQs for the C interface.">L4::Irq</a> is to ensure that incoming trigger signals do not interfere with any open-wait operations, as used for example in a server loop.</p>
<p>Note that this is a kernel-level semaphore primitive that shall be used to implement user-level, application-usable synchronization primitives. For example, use pthread_mutex functions in applications if possible. When implementing a synchronization primitive, please ensure to only use <a class="el" href="structL4_1_1Semaphore.html" title="C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.">L4::Semaphore</a> in the case of contention, and use atomic operations for the non-contended case. </p>
<p class="definition">Definition at line <a class="el" href="semaphore_source.html#l00051">51</a> of file <a class="el" href="semaphore_source.html">semaphore</a>.</p>
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Member Function Documentation</h2>
<a id="a5db9d69c03c135a9ae92d8a523cd9a4c" name="a5db9d69c03c135a9ae92d8a523cd9a4c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5db9d69c03c135a9ae92d8a523cd9a4c">&#9670;&#160;</a></span>down()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structl4__msgtag__t.html">l4_msgtag_t</a> L4::Semaphore::down </td>
<td>(</td>
<td class="paramtype"><a class="el" href="unionl4__timeout__t.html">l4_timeout_t</a></td> <td class="paramname"><span class="paramname"><em>timeout</em></span><span class="paramdefsep"> = </span><span class="paramdefval"><a class="el" href="group__l4__timeout__api.html#gaf01c5e1475efc4f33bc7d1985f7320d3">L4_IPC_NEVER</a></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__l4__utcb__api.html#ga89be8a86d11c1d532b636cc2df1330fb">l4_utcb_t</a> *</td> <td class="paramname"><span class="paramname"><em>utcb</em></span><span class="paramdefsep"> = </span><span class="paramdefval"><a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644">l4_utcb</a>()</span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel noexcept">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="structL4_1_1Semaphore.html" title="C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.">Semaphore</a> down operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">timeout</td><td>Timeout for blocking the semaphore down operation. Note: The receive timeout of this timeout-pair is significant for blocking, the send part is usually non-blocking. </td></tr>
<tr><td class="paramname">utcb</td><td>UTCB to be used for this operation, shall be the UTCB of the calling thread. See <a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644" title="Get the UTCB address.">l4_utcb</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Syscall return tag. Use <a class="el" href="group__l4__ipc__err__api.html#ga05c11e3e10b6c2aa941396ac2018899f" title="Get IPC error code if any or message tag label otherwise for an IPC call.">l4_error()</a> to check for errors. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">-L4_EPERM</td><td>Insufficient permissions; see precondition.</td></tr>
</table>
</dd>
</dl>
<dl class="section pre"><dt>Precondition</dt><dd>The invoked <a class="el" href="structL4_1_1Semaphore.html" title="C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.">Semaphore</a> capability must have the permission <a class="el" href="group__l4__fpage__api.html#ggaee60789a48cab2782f5a368237591b39acb2b2e95f6be245f64937ac48a068066" title="Interface specific &#39;S&#39; right for capability flexpages.">L4_CAP_FPAGE_S</a>.</dd></dl>
<p>This method decrements the semaphore counter by one, or blocks if the counter is already zero, until either a timeout or cancel condition hits or the counter is increased by an <span class="tt"><a class="el" href="#a3de7e4e35ff4dadab9a26f3b87fb76bc" title="Semaphore up operation (wrapper for trigger()).">up()</a></span> operation. </p>
<p class="definition">Definition at line <a class="el" href="semaphore_source.html#l00089">89</a> of file <a class="el" href="semaphore_source.html">semaphore</a>.</p>
<p class="reference">References <a class="el" href="kobject_source.html#l00069">L4::Kobject::cap()</a>, and <a class="el" href="____timeout_8h_source.html#l00076">L4_IPC_NEVER</a>.</p>
<div id="dynsection-2" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Here is the call graph for this function:</div>
<div id="dynsection-2-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-2-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="structL4_1_1Semaphore_a5db9d69c03c135a9ae92d8a523cd9a4c_cgraph.svg" width="346" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="a3de7e4e35ff4dadab9a26f3b87fb76bc" name="a3de7e4e35ff4dadab9a26f3b87fb76bc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3de7e4e35ff4dadab9a26f3b87fb76bc">&#9670;&#160;</a></span>up()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structl4__msgtag__t.html">l4_msgtag_t</a> L4::Semaphore::up </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__l4__utcb__api.html#ga89be8a86d11c1d532b636cc2df1330fb">l4_utcb_t</a> *</td> <td class="paramname"><span class="paramname"><em>utcb</em></span><span class="paramdefsep"> = </span><span class="paramdefval"><a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644">l4_utcb</a>()</span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel noexcept">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="structL4_1_1Semaphore.html" title="C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.">Semaphore</a> up operation (wrapper for <a class="el" href="structL4_1_1Triggerable.html#a7109ca8b4aeac0169639f973c91a3a6b" title="Trigger the object.">trigger()</a>). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">utcb</td><td>UTCB to be used for this operation, shall be the UTCB of the calling thread. See <a class="el" href="group__l4__utcb__api.html#gadc099b4a59e1d99638c72c11a8c8b644" title="Get the UTCB address.">l4_utcb</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Syscall return tag for a send-only operation, this means there is no return value except <a class="el" href="group__l4__msgtag__api.html#gga16589e963a73c13aefd2760ce418e053aad1669664171cc979970b1e2300bd463" title="Error indicator flag.">L4_MSGTAG_ERROR</a> indicating success or failure of the send operation. Use <a class="el" href="group__l4__ipc__err__api.html#gad40f404217497793e95a10d77a47db39" title="Get the IPC error code for an IPC operation.">l4_ipc_error()</a> to check for errors and <b>do not</b> use <a class="el" href="group__l4__ipc__err__api.html#ga05c11e3e10b6c2aa941396ac2018899f" title="Get IPC error code if any or message tag label otherwise for an IPC call.">l4_error()</a>.</dd></dl>
<p>Increases the semaphore counter by one if it is smaller than an unspecified limit. The unspecified limit is guaranteed to be at least 2^31-1. </p>
<p class="definition">Definition at line <a class="el" href="semaphore_source.html#l00067">67</a> of file <a class="el" href="semaphore_source.html">semaphore</a>.</p>
<p class="reference">References <a class="el" href="irq_source.html#l00091">L4::Triggerable::trigger()</a>.</p>
<div id="dynsection-3" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Here is the call graph for this function:</div>
<div id="dynsection-3-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-3-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="structL4_1_1Semaphore_a3de7e4e35ff4dadab9a26f3b87fb76bc_cgraph.svg" width="796" height="110"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>l4/sys/<a class="el" href="semaphore_source.html">semaphore</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- HTML footer for doxygen 1.9.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a href="namespaceL4.html">L4</a></li><li class="navelem"><a href="structL4_1_1Semaphore.html">Semaphore</a></li>
<li class="footer">Generated on <span class="timestamp"></span> for L4Re Operating System Framework by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.15.0 </li>
</ul>
</div>
</body>
</html>