<!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/html; charset=UTF-8" /><title>System.Posix.Semaphore</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_System-Posix-Semaphore.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">unix-2.5.1.1: POSIX functionality</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable (requires POSIX)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">System.Posix.Semaphore</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>POSIX named semaphore support. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:OpenSemFlags">OpenSemFlags</a> = <a href="#v:OpenSemFlags">OpenSemFlags</a> {<ul class="subs"><li><a href="#v:semCreate">semCreate</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li><a href="#v:semExclusive">semExclusive</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li></ul>}</li><li class="src short"><span class="keyword">data</span> <a href="#t:Semaphore">Semaphore</a> </li><li class="src short"><a href="#v:semOpen">semOpen</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -> <a href="System-Posix-Semaphore.html#t:OpenSemFlags">OpenSemFlags</a> -> <a href="../base-4.5.1.0/System-Posix-Types.html#t:FileMode">FileMode</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a></li><li class="src short"><a href="#v:semUnlink">semUnlink</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:semWait">semWait</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:semTryWait">semTryWait</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:semThreadWait">semThreadWait</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:semPost">semPost</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:semGetValue">semGetValue</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:OpenSemFlags" class="def">OpenSemFlags</a> </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:OpenSemFlags" class="def">OpenSemFlags</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:semCreate" class="def">semCreate</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></dt><dd class="doc"><p>If true, create the semaphore if it does not yet exist. </p></dd><dt class="src"><a name="v:semExclusive" class="def">semExclusive</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></dt><dd class="doc"><p>If true, throw an exception if the semaphore already exists. </p></dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Semaphore" class="def">Semaphore</a> </p></div><div class="top"><p class="src"><a name="v:semOpen" class="def">semOpen</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -> <a href="System-Posix-Semaphore.html#t:OpenSemFlags">OpenSemFlags</a> -> <a href="../base-4.5.1.0/System-Posix-Types.html#t:FileMode">FileMode</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a></p><div class="doc"><p>Open a named semaphore with the given name, flags, mode, and initial value. </p></div></div><div class="top"><p class="src"><a name="v:semUnlink" class="def">semUnlink</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Delete the semaphore with the given name. </p></div></div><div class="top"><p class="src"><a name="v:semWait" class="def">semWait</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Lock the semaphore, blocking until it becomes available. Since this is done through a system call, this will block the *entire runtime*, not just the current thread. If this is not the behaviour you want, use semThreadWait instead. </p></div></div><div class="top"><p class="src"><a name="v:semTryWait" class="def">semTryWait</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Attempt to lock the semaphore without blocking. Immediately return False if it is not available. </p></div></div><div class="top"><p class="src"><a name="v:semThreadWait" class="def">semThreadWait</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Poll the semaphore until it is available, then lock it. Unlike semWait, this will block only the current thread rather than the entire process. </p></div></div><div class="top"><p class="src"><a name="v:semPost" class="def">semPost</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Unlock the semaphore. </p></div></div><div class="top"><p class="src"><a name="v:semGetValue" class="def">semGetValue</a> :: <a href="System-Posix-Semaphore.html#t:Semaphore">Semaphore</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a></p><div class="doc"><p>Return the semaphore's current value. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>