Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 5fc82cd2dfd40b1b8acca39dd2860281 > files > 32

log4cpp-1.0-4.fc12.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>log4cpp: BoostThreads.hh 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.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>BoostThreads.hh</h1><a href="BoostThreads_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * BoostThreads.hh</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved.</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright 2002, Bastiaan Bakker. All rights reserved.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * See the COPYING file for the terms of usage and distribution.</span>
<a name="l00008"></a>00008 <span class="comment"> */</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef _LOG4CPP_THREADING_BOOSTTHREADS_HH</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define _LOG4CPP_THREADING_BOOSTTHREADS_HH</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;<a class="code" href="Portability_8hh.html">log4cpp/Portability.hh</a>&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;boost/thread/thread.hpp&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;boost/thread/mutex.hpp&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;boost/thread/tss.hpp&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="keyword">namespace </span>log4cpp {
<a name="l00021"></a><a class="code" href="namespacelog4cpp_1_1threading.html">00021</a>     <span class="keyword">namespace </span>threading {
<a name="l00022"></a><a class="code" href="namespacelog4cpp_1_1threading.html#f2f7960b92e64a8beb0dcb08ee6bf378">00022</a>         <span class="keyword">static</span> std::string <a class="code" href="namespacelog4cpp_1_1threading.html#f2f7960b92e64a8beb0dcb08ee6bf378" title="Return an identifier for the current thread.">getThreadId</a>() {
<a name="l00023"></a>00023             <span class="keywordtype">char</span> buffer[14];
<a name="l00024"></a>00024             <span class="comment">// Boost.Threads stores the thread ID but doesn't expose it</span>
<a name="l00025"></a>00025             sprintf(buffer, <span class="stringliteral">"not available"</span>);
<a name="l00026"></a>00026             <span class="keywordflow">return</span> std::string(buffer);
<a name="l00027"></a><a class="code" href="namespacelog4cpp_1_1threading.html#ae98297fe1256bc51b1252c241aef4f1">00027</a>         };
<a name="l00028"></a>00028         
<a name="l00029"></a>00029         <span class="keyword">typedef</span> boost::mutex <a class="code" href="namespacelog4cpp_1_1threading.html#ae98297fe1256bc51b1252c241aef4f1" title="Dummy type &amp;#39;int&amp;#39; for Mutex.">Mutex</a>;
<a name="l00030"></a><a class="code" href="namespacelog4cpp_1_1threading.html#b5526cf96c18d52f46843e6411d44f7c">00030</a>         <span class="keyword">typedef</span> boost::mutex::scoped_lock <a class="code" href="classlog4cpp_1_1threading_1_1ScopedLock.html" title="definition of ScopedLock;">ScopedLock</a>;
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html">00032</a>         <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keyword">class </span><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html" title="This class holds Thread local data of type T, i.e.">ThreadLocalDataHolder</a> {
<a name="l00033"></a>00033             <span class="keyword">public</span>:
<a name="l00034"></a><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#d52fc17c6f4e05576683cd4d05360578">00034</a>             <span class="keyword">inline</span> T* <span class="keyword">get</span>() <span class="keyword">const</span> {
<a name="l00035"></a>00035                 <span class="keywordflow">return</span> _localData.get();
<a name="l00036"></a>00036             };
<a name="l00037"></a>00037 
<a name="l00038"></a><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#0f11f5568a87c5e9e7e4b352e29c5cc5">00038</a>             <span class="keyword">inline</span> T* <a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#0f11f5568a87c5e9e7e4b352e29c5cc5">operator-&gt;</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _localData.get(); };
<a name="l00039"></a><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#3a702989aa1c8e8cc52ad83740a52321">00039</a>             <span class="keyword">inline</span> T&amp; <a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#3a702989aa1c8e8cc52ad83740a52321">operator*</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *_localData.get(); };
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#299e9e1f9e02ef2668e64f81b1d29204">00041</a>             <span class="keyword">inline</span> T* <a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#299e9e1f9e02ef2668e64f81b1d29204">release</a>() {
<a name="l00042"></a>00042                 <span class="keywordflow">return</span> _localData.release();
<a name="l00043"></a>00043             };
<a name="l00044"></a>00044 
<a name="l00045"></a><a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#e45b1bbee63188f40ed0a1fd262903dc">00045</a>             <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classlog4cpp_1_1threading_1_1ThreadLocalDataHolder.html#e45b1bbee63188f40ed0a1fd262903dc">reset</a>(T* p = NULL) {
<a name="l00046"></a>00046                 _localData.reset(p);
<a name="l00047"></a>00047             };
<a name="l00048"></a>00048 
<a name="l00049"></a>00049             <span class="keyword">private</span>:
<a name="l00050"></a>00050             boost::thread_specific_ptr&lt;T&gt; _localData;
<a name="l00051"></a>00051         };
<a name="l00052"></a>00052 
<a name="l00053"></a>00053     }
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jul 26 19:34:50 2009 for log4cpp by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>