<!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"/> <title>GNU Radio 3.2.2 C++ API: mbi_runtime_lock.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2 --> <h1>mbi_runtime_lock.h</h1><a href="mbi__runtime__lock_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c++ -*- */</span> <a name="l00002"></a>00002 <span class="comment">/*</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright 2007,2008 Free Software Foundation, Inc.</span> <a name="l00004"></a>00004 <span class="comment"> * </span> <a name="l00005"></a>00005 <span class="comment"> * This file is part of GNU Radio</span> <a name="l00006"></a>00006 <span class="comment"> * </span> <a name="l00007"></a>00007 <span class="comment"> * GNU Radio is free software; you can redistribute it and/or modify</span> <a name="l00008"></a>00008 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> <a name="l00009"></a>00009 <span class="comment"> * the Free Software Foundation; either version 3, or (at your option)</span> <a name="l00010"></a>00010 <span class="comment"> * any later version.</span> <a name="l00011"></a>00011 <span class="comment"> * </span> <a name="l00012"></a>00012 <span class="comment"> * GNU Radio is distributed in the hope that it will be useful,</span> <a name="l00013"></a>00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00014"></a>00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00015"></a>00015 <span class="comment"> * GNU General Public License for more details.</span> <a name="l00016"></a>00016 <span class="comment"> * </span> <a name="l00017"></a>00017 <span class="comment"> * You should have received a copy of the GNU General Public License along</span> <a name="l00018"></a>00018 <span class="comment"> * with this program; if not, write to the Free Software Foundation, Inc.,</span> <a name="l00019"></a>00019 <span class="comment"> * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</span> <a name="l00020"></a>00020 <span class="comment"> */</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef INCLUDED_MBI_RUNTIME_LOCK_H</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define INCLUDED_MBI_RUNTIME_LOCK_H</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <<a class="code" href="runtime_8h.html">mblock/runtime.h</a>></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <<a class="code" href="mb__mblock__impl_8h.html">mb_mblock_impl.h</a>></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <boost/utility.hpp></span> <a name="l00028"></a>00028 <span class="comment"></span> <a name="l00029"></a>00029 <span class="comment">/*!</span> <a name="l00030"></a>00030 <span class="comment"> * \brief acquire and release big runtime lock</span> <a name="l00031"></a>00031 <span class="comment"> *</span> <a name="l00032"></a>00032 <span class="comment"> * As an alternative to:</span> <a name="l00033"></a>00033 <span class="comment"> * {</span> <a name="l00034"></a>00034 <span class="comment"> * rt->lock();</span> <a name="l00035"></a>00035 <span class="comment"> * .....</span> <a name="l00036"></a>00036 <span class="comment"> * rt->unlock();</span> <a name="l00037"></a>00037 <span class="comment"> * }</span> <a name="l00038"></a>00038 <span class="comment"> *</span> <a name="l00039"></a>00039 <span class="comment"> * you can use a single instance of the mbi_runtime_lock class:</span> <a name="l00040"></a>00040 <span class="comment"> *</span> <a name="l00041"></a>00041 <span class="comment"> * {</span> <a name="l00042"></a>00042 <span class="comment"> * mbi_runtime_lock l(rt);</span> <a name="l00043"></a>00043 <span class="comment"> * ....</span> <a name="l00044"></a>00044 <span class="comment"> * }</span> <a name="l00045"></a>00045 <span class="comment"> *</span> <a name="l00046"></a>00046 <span class="comment"> * This has the advantage that rt->unlock() will be called automatically</span> <a name="l00047"></a>00047 <span class="comment"> * when an exception is thrown.</span> <a name="l00048"></a>00048 <span class="comment"> */</span> <a name="l00049"></a>00049 <a name="l00050"></a><a class="code" href="classmbi__runtime__lock.html">00050</a> <span class="keyword">class </span><a class="code" href="classmbi__runtime__lock.html" title="acquire and release big runtime lock">mbi_runtime_lock</a> : boost::noncopyable { <a name="l00051"></a>00051 <a class="code" href="classmb__runtime__base.html">mb_runtime_base</a> *d_rt; <a name="l00052"></a>00052 <span class="keyword">public</span>: <a name="l00053"></a><a class="code" href="classmbi__runtime__lock.html#a91868971e4953dc526ddf86b477edbd3">00053</a> <a class="code" href="classmbi__runtime__lock.html#a91868971e4953dc526ddf86b477edbd3">mbi_runtime_lock</a>(<a class="code" href="classmb__runtime__base.html">mb_runtime_base</a> *rt) : d_rt(rt) { d_rt-><a class="code" href="classmb__runtime__base.html#ac9944a6774ab7ba81eca59d1ea0e673f" title="lock the big runtime lock">lock</a>(); } <a name="l00054"></a><a class="code" href="classmbi__runtime__lock.html#a7db7ee73b22300cfbe77728ce50e26ff">00054</a> <a class="code" href="classmbi__runtime__lock.html#a7db7ee73b22300cfbe77728ce50e26ff">mbi_runtime_lock</a>(<a class="code" href="classmb__mblock__impl.html" title="The private implementation details of the mblock system.">mb_mblock_impl</a> *mi) : d_rt(mi->runtime()) { d_rt-><a class="code" href="classmb__runtime__base.html#ac9944a6774ab7ba81eca59d1ea0e673f" title="lock the big runtime lock">lock</a>(); } <a name="l00055"></a><a class="code" href="classmbi__runtime__lock.html#a22937b7728566aee4a8e1ecab1d120e4">00055</a> <a class="code" href="classmbi__runtime__lock.html#a22937b7728566aee4a8e1ecab1d120e4">mbi_runtime_lock</a>(<a class="code" href="classmb__mblock.html" title="Parent class for all message passing blocks.">mb_mblock</a> *mb) : d_rt(mb->impl()->runtime()) { d_rt-><a class="code" href="classmb__runtime__base.html#ac9944a6774ab7ba81eca59d1ea0e673f" title="lock the big runtime lock">lock</a>(); } <a name="l00056"></a><a class="code" href="classmbi__runtime__lock.html#ab1d3643d42a9040b71a0d4b1c5fec255">00056</a> <a class="code" href="classmbi__runtime__lock.html#ab1d3643d42a9040b71a0d4b1c5fec255">~mbi_runtime_lock</a>(<span class="keywordtype">void</span>) { d_rt-><a class="code" href="classmb__runtime__base.html#abb6d8310dfeec507938fef91425a963a" title="unlock the big runtime lock">unlock</a>(); } <a name="l00057"></a>00057 <a name="l00058"></a>00058 }; <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="preprocessor">#endif </span><span class="comment">/* INCLUDED_MBI_RUNTIME_LOCK_H */</span> <a name="l00061"></a>00061 </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>