Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > ed376d6842ea322c25405e7c23b3bc12 > files > 70

libcommoncpp-devel-1.8.0-5.1mdv2010.1.i586.rpm

<!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 CommonC++: bug1.cpp</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.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>bug1.cpp</h1><div class="fragment"><pre class="fragment"><span class="comment">// Copyright (C) 1999-2005 Open Source Telecom Corporation.</span>
<span class="comment">// Copyright (C) 2006-2008 David Sugar, Tycho Softworks.</span>
<span class="comment">//</span>
<span class="comment">// This program is free software; you can redistribute it and/or modify</span>
<span class="comment">// it under the terms of the GNU General Public License as published by</span>
<span class="comment">// the Free Software Foundation; either version 2 of the License, or</span>
<span class="comment">// (at your option) any later version.</span>
<span class="comment">//</span>
<span class="comment">// This program is distributed in the hope that it will be useful,</span>
<span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span class="comment">// GNU General Public License for more details.</span>
<span class="comment">//</span>
<span class="comment">// You should have received a copy of the GNU General Public License</span>
<span class="comment">// along with this program; if not, write to the Free Software</span>
<span class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span>
<span class="comment">//</span>
<span class="comment">// As a special exception to the GNU General Public License, permission is</span>
<span class="comment">// granted for additional uses of the text contained in its release</span>
<span class="comment">// of APE.</span>
<span class="comment">//</span>
<span class="comment">// The exception is that, if you link the APE library with other files</span>
<span class="comment">// to produce an executable, this does not by itself cause the</span>
<span class="comment">// resulting executable to be covered by the GNU General Public License.</span>
<span class="comment">// Your use of that executable is in no way restricted on account of</span>
<span class="comment">// linking the APE library code into it.</span>
<span class="comment">//</span>
<span class="comment">// This exception does not however invalidate any other reasons why</span>
<span class="comment">// the executable file might be covered by the GNU General Public License.</span>
<span class="comment">//</span>
<span class="comment">// This exception applies only to the code released under the</span>
<span class="comment">// name APE.  If you copy code from other releases into a copy of</span>
<span class="comment">// APE, as the General Public License permits, the exception does</span>
<span class="comment">// not apply to the code that you add in this way.  To avoid misleading</span>
<span class="comment">// anyone as to the status of such modified files, you must delete</span>
<span class="comment">// this exception notice from them.</span>
<span class="comment">//</span>
<span class="comment">// If you write modifications of your own for APE, it is your choice</span>
<span class="comment">// whether to permit this exception to apply to your modifications.</span>
<span class="comment">// If you do not wish that, delete this exception notice.</span>

<span class="preprocessor">#include &lt;<a class="code" href="thread_8h.html" title="Synchronization and threading services.">cc++/thread.h</a>&gt;</span>
<span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;cstdio&gt;</span>

<span class="comment">// This was a test case for a bug report related to the final self-</span>
<span class="comment">// deleting the thread.</span>

<span class="preprocessor">#ifdef  CCXX_NAMESPACES</span>
<span class="preprocessor"></span><span class="keyword">using namespace </span>std;
<span class="keyword">using namespace </span>ost;
<span class="preprocessor">#endif</span>
<span class="preprocessor"></span>
<span class="keyword">class </span>ThreadTest : <span class="keyword">public</span> <a name="_a0"></a><a class="code" href="classost_1_1_thread.html" title="Every thread of execution in an application is created by instantiating an object...">Thread</a>
{
<span class="keyword">private</span>:
        <span class="keywordtype">void</span> <a name="a1"></a><a class="code" href="classost_1_1_thread.html#add7d339d94b8a1ed2b2b0324a95b7e74" title="All threads execute by deriving the Run method of Thread.">run</a>() { cout &lt;&lt; <span class="stringliteral">&quot;Run()...&quot;</span> &lt;&lt; endl;};
        <span class="keywordtype">void</span> <span class="keyword">final</span>() { cout &lt;&lt; <span class="stringliteral">&quot;Final()...&quot;</span> &lt;&lt; endl;};
};

<span class="keywordtype">int</span> main()
{
        ThreadTest *thread = <span class="keyword">new</span> ThreadTest;
        cout &lt;&lt; <span class="stringliteral">&quot;before start()...&quot;</span> &lt;&lt; endl;
<span class="comment">//      printf(&quot;THREAD is %p\n&quot;, thread); not useful in reg test</span>
        thread-&gt;start();
        Thread::sleep(5000);
        cout &lt;&lt; <span class="stringliteral">&quot;exiting...&quot;</span> &lt;&lt; endl;
        <span class="comment">// do not delete thread, already deleted in method Final</span>
        <span class="keywordflow">return</span> 0;
}


</pre></div> </div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Nov 12 09:55:46 2010 for GNU CommonC++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>