<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Class interprocess_recursive_mutex</title> <link rel="stylesheet" href="../../boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../boost_interprocess_reference.html#header.boost.interprocess.sync.interprocess_recursive_mutex_hpp" title="Header <boost/interprocess/sync/interprocess_recursive_mutex.hpp>"> <link rel="prev" href="interprocess_mutex.html" title="Class interprocess_mutex"> <link rel="next" href="interprocess_semaphore.html" title="Class interprocess_semaphore"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> <td align="center"><a href="../../../../index.html">Home</a></td> <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="interprocess_mutex.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_interprocess_reference.html#header.boost.interprocess.sync.interprocess_recursive_mutex_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="interprocess_semaphore.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a> </div> <div class="refentry" title="Class interprocess_recursive_mutex"> <a name="boost.interprocess.interprocess_recursive__id821645"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Class interprocess_recursive_mutex</span></h2> <p>boost::interprocess::interprocess_recursive_mutex</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="emphasis"><em>// In header: <<a class="link" href="../../boost_interprocess_reference.html#header.boost.interprocess.sync.interprocess_recursive_mutex_hpp" title="Header <boost/interprocess/sync/interprocess_recursive_mutex.hpp>">boost/interprocess/sync/interprocess_recursive_mutex.hpp</a>> </em></span> <span class="bold"><strong>class</strong></span> <a class="link" href="interprocess_recursive__id821645.html" title="Class interprocess_recursive_mutex">interprocess_recursive_mutex</a> { <span class="bold"><strong>public</strong></span>: <span class="emphasis"><em>// <a class="link" href="interprocess_recursive__id821645.html#boost.interprocess.interprocess_recursive__id821645construct-copy-destruct">construct/copy/destruct</a></em></span> <a class="link" href="interprocess_recursive__id821645.html#id821743-bb">interprocess_recursive_mutex</a>(); <a class="link" href="interprocess_recursive__id821645.html#id821748-bb">~interprocess_recursive_mutex</a>(); <span class="emphasis"><em>// <a class="link" href="interprocess_recursive__id821645.html#id821654-bb">public member functions</a></em></span> <span class="type"><span class="bold"><strong>void</strong></span></span> <a class="link" href="interprocess_recursive__id821645.html#id821658-bb">lock</a>(<span class="bold"><strong>void</strong></span>) ; <span class="type"><span class="bold"><strong>bool</strong></span></span> <a class="link" href="interprocess_recursive__id821645.html#id821681-bb">try_lock</a>(<span class="bold"><strong>void</strong></span>) ; <span class="type"><span class="bold"><strong>bool</strong></span></span> <a class="link" href="interprocess_recursive__id821645.html#id821701-bb">timed_lock</a>(<span class="bold"><strong>const</strong></span> boost::posix_time::ptime &) ; <span class="type"><span class="bold"><strong>void</strong></span></span> <a class="link" href="interprocess_recursive__id821645.html#id821722-bb">unlock</a>(<span class="bold"><strong>void</strong></span>) ; };</pre></div> <div class="refsect1" title="Description"> <a name="id1057276"></a><h2>Description</h2> <p>Wraps a interprocess_mutex that can be placed in shared memory and can be shared between processes. Allows several locking calls by the same process. Allows timed lock tries </p> <div class="refsect2" title="interprocess_recursive_mutex public construct/copy/destruct"> <a name="id1057285"></a><h3> <a name="boost.interprocess.interprocess_recursive__id821645construct-copy-destruct"></a><code class="computeroutput">interprocess_recursive_mutex</code> public construct/copy/destruct</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><a name="id821743-bb"></a>interprocess_recursive_mutex();</pre> <p>Constructor. Throws interprocess_exception on error. </p> </li> <li class="listitem"> <pre class="literallayout"><a name="id821748-bb"></a>~interprocess_recursive_mutex();</pre> <p>Destructor. If any process uses the mutex after the destructor is called the result is undefined. Does not throw. </p> </li> </ol></div> </div> <div class="refsect2" title="interprocess_recursive_mutex public member functions"> <a name="id1057340"></a><h3> <a name="id821654-bb"></a><code class="computeroutput">interprocess_recursive_mutex</code> public member functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id821658-bb"></a>lock(<span class="bold"><strong>void</strong></span>) ;</pre> <p>Effects: The calling thread tries to obtain ownership of the mutex, and if another thread has ownership of the mutex, it waits until it can obtain the ownership. If a thread takes ownership of the mutex the mutex must be unlocked by the same mutex. The mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception on error. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id821681-bb"></a>try_lock(<span class="bold"><strong>void</strong></span>) ;</pre> <p>Tries to lock the interprocess_mutex, returns false when interprocess_mutex is already locked, returns true when success. The mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception if a severe error is found </p> </li> <li class="listitem"> <pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id821701-bb"></a>timed_lock(<span class="bold"><strong>const</strong></span> boost::posix_time::ptime & abs_time) ;</pre> <p>Tries to lock the interprocess_mutex, if interprocess_mutex can't be locked before abs_time time, returns false. The mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception if a severe error is found </p> </li> <li class="listitem"> <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id821722-bb"></a>unlock(<span class="bold"><strong>void</strong></span>) ;</pre> <p>Effects: The calling thread releases the exclusive ownership of the mutex. If the mutex supports recursive locking, the mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception on error. </p> </li> </ol></div> </div> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2005 - 2008 Ion Gaztanaga<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="interprocess_mutex.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_interprocess_reference.html#header.boost.interprocess.sync.interprocess_recursive_mutex_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="interprocess_semaphore.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a> </div> </body> </html>