Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 332

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>GNU CommonC++: ost::Thread Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<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 id="current"><a href="classes.html"><span>Classes</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_thread.html">Thread</a></div>
<h1>ost::Thread Class Reference</h1><!-- doxytag: class="ost::Thread" -->Every thread of execution in an application is created by instantiating an object of a class derived from the <a class="el" href="classost_1_1_thread.html">Thread</a> class.base class used to derive all threads of execution.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="thread_8h-source.html">thread.h</a>&gt;</code>
<p>
<p>Inheritance diagram for ost::Thread:
<p><center><img src="classost_1_1_thread.png" usemap="#ost::Thread_map" border="0" alt=""></center>
<map name="ost::Thread_map">
<area href="classost_1_1_posix_thread.html" alt="ost::PosixThread" shape="rect" coords="0,56,116,80">
<area href="classost_1_1_serial_service.html" alt="ost::SerialService" shape="rect" coords="126,56,242,80">
<area href="classost_1_1_socket_service.html" alt="ost::SocketService" shape="rect" coords="252,56,368,80">
<area href="classost_1_1_t_c_p_session.html" alt="ost::TCPSession" shape="rect" coords="378,56,494,80">
<area href="classost_1_1_thread_queue.html" alt="ost::ThreadQueue" shape="rect" coords="504,56,620,80">
<area href="classost_1_1_t_t_y_session.html" alt="ost::TTYSession" shape="rect" coords="630,56,746,80">
<area href="classost_1_1_unix_session.html" alt="ost::UnixSession" shape="rect" coords="756,56,872,80">
</map>
<a href="classost_1_1_thread-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef enum <a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">ost::Thread::Throw</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">Throw</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">How to raise error.  <a href="#511f08b9f1aef08b4f02e2ad225960ab"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef enum <a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">ost::Thread::Cancel</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">How work cancellation.  <a href="#0d876c60edcf92d3d96121aacea441d0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef enum <a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">ost::Thread::Suspend</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">Suspend</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">How work suspend.  <a href="#81069ba4a0bf16a0aa9f076aa725f0c1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#b9538e839c06104af2974b77d2a5674d">Throw</a> { <a class="el" href="classost_1_1_thread.html#b9538e839c06104af2974b77d2a5674d1b058025329425c90f383d124ee605e5">throwNothing</a>, 
<a class="el" href="classost_1_1_thread.html#b9538e839c06104af2974b77d2a5674dea5957cd08cfecf17f366352bcf9ad80">throwObject</a>, 
<a class="el" href="classost_1_1_thread.html#b9538e839c06104af2974b77d2a5674d8e51a6870e65238764becffff92d7f54">throwException</a>
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">How to raise error.  <a href="classost_1_1_thread.html#b9538e839c06104af2974b77d2a5674d">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69b">Cancel</a> { <br>
&nbsp;&nbsp;<a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69bbbf14157c17311ec31f0967032ecb357">cancelInitial</a> = 0, 
<a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69bb02b8cd8d899a693e8cbb86082f4ef16">cancelDeferred</a> = 1, 
<a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69b57f820ea4f7a326c27cc504a213e167d">cancelImmediate</a>, 
<a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69be07cc9f6d3d7333c8cce543a8bb58215">cancelDisabled</a>, 
<br>
&nbsp;&nbsp;<a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69ba194b63cafc5387684afe7943fe3b5f0">cancelManual</a>, 
<a class="el" href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69bdf753e6d700f194c1b8f695a9bd67554">cancelDefault</a> = cancelDeferred
<br>
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">How work cancellation.  <a href="classost_1_1_thread.html#24f333b09607b7c48a97e05865ada69b">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#ff7bd364ce645eac95affbf74f1a7087">Suspend</a> { <a class="el" href="classost_1_1_thread.html#ff7bd364ce645eac95affbf74f1a708727f2f61f4bc18b64e9c25f73bb008a38">suspendEnable</a>, 
<a class="el" href="classost_1_1_thread.html#ff7bd364ce645eac95affbf74f1a70870e9f14f0e69d8c12c36a46d108a5074b">suspendDisable</a>
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">How work suspend.  <a href="classost_1_1_thread.html#ff7bd364ce645eac95affbf74f1a7087">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#72470c1b00d098e74162284e248c0435">Thread</a> (bool isMain)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This is actually a special constructor that is used to create a thread "object" for the current execution context when that context is not created via an instance of a derived <a class="el" href="classost_1_1_thread.html">Thread</a> object itself.  <a href="#72470c1b00d098e74162284e248c0435"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#082ea94f104219969a2d75becc749af6">Thread</a> (int pri=0, size_t stack=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When a thread object is contructed, a new thread of execution context is created.  <a href="#082ea94f104219969a2d75becc749af6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#0ba7f4211aabb5a278c546d0fae81f55">Thread</a> (const <a class="el" href="classost_1_1_thread.html">Thread</a> &amp;th)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A thread of execution can also be specified by cloning an existing thread.  <a href="#0ba7f4211aabb5a278c546d0fae81f55"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#d363397f26006af68fa9315c9bff8589">~Thread</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The thread destructor should clear up any resources that have been allocated by the thread.  <a href="#d363397f26006af68fa9315c9bff8589"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#2ef198d7aefb93cf9de4fcc6b66c27a2">start</a> (<a class="el" href="classost_1_1_semaphore.html">Semaphore</a> *start=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When a new thread is created, it does not begin immediate execution.  <a href="#2ef198d7aefb93cf9de4fcc6b66c27a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#c30778f0fffd9dd952fd73cb541cc70b">detach</a> (<a class="el" href="classost_1_1_semaphore.html">Semaphore</a> *start=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start a new thread as "detached".  <a href="#c30778f0fffd9dd952fd73cb541cc70b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classost_1_1_thread.html">Thread</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#ac5bc230c3bad5c837baa9e6d01f4c24">getParent</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Gets the pointer to the <a class="el" href="classost_1_1_thread.html">Thread</a> class which created the current thread object.  <a href="#ac5bc230c3bad5c837baa9e6d01f4c24"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#5f1b650c1f3b71e458adfbd86b3acb83">suspend</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Suspends execution of the selected thread.  <a href="#5f1b650c1f3b71e458adfbd86b3acb83"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#0861f734ad77b1ba517fce302215e41e">resume</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resumes execution of the selected thread.  <a href="#0861f734ad77b1ba517fce302215e41e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#3524521d80bcc0562fb59a28ce5d62a4">getCancel</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used to retrieve the cancellation mode in effect for the selected thread.  <a href="#3524521d80bcc0562fb59a28ce5d62a4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#16f6de1f41e82c6edee5465922dfe5ab">isRunning</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Verifies if the thread is still running or has already been terminated but not yet deleted.  <a href="#16f6de1f41e82c6edee5465922dfe5ab"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#fab1a3194f6c0753748584a6c68e8e28">isDetached</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if this thread is detached.  <a href="#fab1a3194f6c0753748584a6c68e8e28"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#1e6d355ea0d9b0b023f3fc2aa91a25e8">join</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Blocking call which unlocks when thread terminates.  <a href="#1e6d355ea0d9b0b023f3fc2aa91a25e8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#c25f1fcbb5f0cb2e683d746c94b255f6">isThread</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Tests to see if the current execution context is the same as the specified thread object.  <a href="#c25f1fcbb5f0cb2e683d746c94b255f6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="thread_8h.html#3f0d0226a694bf1e508e1b1c758e6ae6">cctid_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#3947a150139cf226626f47166ff92286">getId</a> (void) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get system thread numeric identifier.  <a href="#3947a150139cf226626f47166ff92286"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#e78f5d3f965bff1b6aa4ae6dacc5cc35">getName</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the name string for this thread, to use in debug messages.  <a href="#e78f5d3f965bff1b6aa4ae6dacc5cc35"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classost_1_1_thread.html">Thread</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#aad41a9f7962bdc3058a429df48246fd">get</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#ccd29b724539d63a8495d954f9f56c72">setStack</a> (size_t size=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set base stack limit before manual stack sizes have effect.  <a href="#ccd29b724539d63a8495d954f9f56c72"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#663d960e8599194f3b25169915c22fb6">sleep</a> (<a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a> msec)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A thread-safe sleep call.  <a href="#663d960e8599194f3b25169915c22fb6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#3f4a4f9872ed8f80a591e6b020ecf5d7">yield</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Yields the current thread's CPU time slice to allow another thread to begin immediate execution.  <a href="#3f4a4f9872ed8f80a591e6b020ecf5d7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">Throw</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#0272b6a8de586ee5ee2464bbdb030392">getException</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get exception mode of the current thread.  <a href="#0272b6a8de586ee5ee2464bbdb030392"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#e9f30b27ca1322ccc3325ba9ca5157fa">setException</a> (<a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">Throw</a> mode)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set exception mode of the current thread.  <a href="#e9f30b27ca1322ccc3325ba9ca5157fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#599880181a0aeaef8a0ddedeeceddb9a">enterCancel</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This is used to help build wrapper functions in libraries around system calls that should behave as cancellation points but don't.  <a href="#599880181a0aeaef8a0ddedeeceddb9a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#bcad222419e4106ac21ce12605eb4fe7">exitCancel</a> (<a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a> cancel)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This is used to restore a cancel block.  <a href="#bcad222419e4106ac21ce12605eb4fe7"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#b6f72653183c4db0dfd6b254ddbf072e">setName</a> (const char *text)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the name of the current thread.  <a href="#b6f72653183c4db0dfd6b254ddbf072e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run</a> (void)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">All threads execute by deriving the Run method of <a class="el" href="classost_1_1_thread.html">Thread</a>.  <a href="#dd7d339d94b8a1ed2b2b0324a95b7e74"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#6fb521eb3d23c51925472a3fe0abf327">final</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A thread that is self terminating, either by invoking <a class="el" href="classost_1_1_thread.html#cd315d7c877b346970680d739da3e994">exit()</a> or leaving it's <a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run()</a>, will have this method called.  <a href="#6fb521eb3d23c51925472a3fe0abf327"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#300c229e76725eeddc69867f7ecea91f">initial</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The initial method is called by a newly created thread when it starts execution.  <a href="#300c229e76725eeddc69867f7ecea91f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#b73c94e3ca46cb24f4246e71fff73026">getExtended</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Since <a class="el" href="classost_1_1_thread.html#ac5bc230c3bad5c837baa9e6d01f4c24">getParent()</a> and <a class="el" href="namespaceost.html#99c7f7d02b00922b0f5ee62fc3bb75fd">getThread()</a> only refer to an object of the <a class="el" href="classost_1_1_thread.html">Thread</a> "base" type, this virtual method can be replaced in a derived class with something that returns data specific to the derived class that can still be accessed through the pointer returned by <a class="el" href="classost_1_1_thread.html#ac5bc230c3bad5c837baa9e6d01f4c24">getParent()</a> and <a class="el" href="namespaceost.html#99c7f7d02b00922b0f5ee62fc3bb75fd">getThread()</a>.  <a href="#b73c94e3ca46cb24f4246e71fff73026"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#390827ad98d3402dd84ee9f128bcd564">notify</a> (<a class="el" href="classost_1_1_thread.html">Thread</a> *)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When a thread terminates, it now sends a notification message to the parent thread which created it.  <a href="#390827ad98d3402dd84ee9f128bcd564"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#cd315d7c877b346970680d739da3e994">exit</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used to properly exit from a <a class="el" href="classost_1_1_thread.html">Thread</a> derived <a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run()</a> or <a class="el" href="classost_1_1_thread.html#300c229e76725eeddc69867f7ecea91f">initial()</a> method.  <a href="#cd315d7c877b346970680d739da3e994"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#1cda4748073c4d55e2d0504e7c9b09cc">sync</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used to wait for a join or cancel, in place of explicit exit.  <a href="#1cda4748073c4d55e2d0504e7c9b09cc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#f8afe7a3330b69dff685415aae14657c">testCancel</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">test a cancellation point for deferred thread cancellation.  <a href="#f8afe7a3330b69dff685415aae14657c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#4bff373a83b90f6f44d1519ef893e35b">setCancel</a> (<a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a> mode)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets thread cancellation mode.  <a href="#4bff373a83b90f6f44d1519ef893e35b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#d226f8bca85bf68ce71d90baca6434d6">setSuspend</a> (<a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">Suspend</a> mode)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the thread's ability to be suspended from execution.  <a href="#d226f8bca85bf68ce71d90baca6434d6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#e71c94c24733ed82f9b74c034744d002">terminate</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used by another thread to terminate the current thread.  <a href="#e71c94c24733ed82f9b74c034744d002"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#5e574c2c5f388277527c9257524dd654">clrParent</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">clear parent thread relationship.  <a href="#5e574c2c5f388277527c9257524dd654"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#bc1a729c4204bc85f58c47042f429acb">PosixThread</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#9b6e94561c96e07e8f2dd776bbc19396">DummyThread</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#bbf97e2c58c760acb67b9db3a7ba11db">Cancellation</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#e156bb5074cfe5c3a729890e0ded952f">postream_type</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#f08013a89bf19b835ba6f75a60f870ed">Slog</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#e3c1cdb20d70b22a5c0bf395614eefff">ThreadImpl</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#2742c471d2abe8712368ccff8d534702">operator++</a> (<a class="el" href="classost_1_1_thread.html">Thread</a> &amp;th)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Signal the semaphore that the specified thread is waiting for before beginning execution.  <a href="#2742c471d2abe8712368ccff8d534702"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_thread.html#a797f8e5a1ea5b857251f98f0d50614e">operator--</a> (<a class="el" href="classost_1_1_thread.html">Thread</a> &amp;th)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Every thread of execution in an application is created by instantiating an object of a class derived from the <a class="el" href="classost_1_1_thread.html">Thread</a> class.base class used to derive all threads of execution. 
<p>
Classes derived from <a class="el" href="classost_1_1_thread.html">Thread</a> must implement the <a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run()</a> method, which specifies the code of the thread. The base <a class="el" href="classost_1_1_thread.html">Thread</a> class supports encapsulation of the generic threading methods implemented on various target operating systems. This includes the ability to start and stop threads in a synchronized and controllable manner, the ability to specify thread execution priority, and thread specific "system call" wrappers, such as for sleep and yield. A thread exception is thrown if the thread cannot be created. Threading was the first part of Common C++ I wrote, back when it was still the APE library. My goal for Common C++ threading has been to make threading as natural and easy to use in C++ application development as threading is in Java. With this said, one does not need to use threading at all to take advantage of Common C++. However, all Common C++ classes are designed at least to be thread-aware/thread-safe as appropriate and necessary.<p>
Common C++ threading is currently built either from the Posix "pthread" library or using the win32 SDK. In that the Posix "pthread" draft has gone through many revisions, and many system implementations are only marginally compliant, and even then usually in different ways, I wrote a large series of autoconf macros found in ost_pthread.m4 which handle the task of identifying which pthread features and capabilities your target platform supports. In the process I learned much about what autoconf can and cannot do for you..<p>
Currently the GNU Portable <a class="el" href="classost_1_1_thread.html">Thread</a> library (GNU pth) is not directly supported in Common C++. While GNU "Pth" doesn't offer direct native threading support or benefit from SMP hardware, many of the design advantages of threading can be gained from it's use, and the Pth pthread "emulation" library should be usable with Common C++. In the future, Common C++ will directly support Pth, as well as OS/2 and BeOS native threading API's.<p>
Common C++ itself defines a fairly "neutral" threading model that is not tied to any specific API such as pthread, win32, etc. This neutral thread model is contained in a series of classes which handle threading and synchronization and which may be used together to build reliable threaded applications.<p>
Common C++ defines application specific threads as objects which are derived from the Common C++ "Thread" base class. At minimum the "Run" method must be implemented, and this method essentially is the "thread", for it is executed within the execution context of the thread, and when the Run method terminates the thread is assumed to have terminated.<p>
Common C++ allows one to specify the running priority of a newly created thread relative to the "parent" thread which is the thread that is executing when the constructor is called. Since most newer C++ implementations do not allow one to call virtual constructors or virtual methods from constructors, the thread must be "started" after the constructor returns. This is done either by defining a "starting" semaphore object that one or more newly created thread objects can wait upon, or by invoking an explicit "start" member function.<p>
Threads can be "suspended" and "resumed". As this behavior is not defined in the Posix "pthread" specification, it is often emulated through signals. Typically SIGUSR1 will be used for this purpose in Common C++ applications, depending in the target platform. On Linux, since threads are indeed processes, SIGSTP and SIGCONT can be used. On solaris, the Solaris thread library supports suspend and resume directly.<p>
Threads can be canceled. Not all platforms support the concept of externally cancelable threads. On those platforms and API implementations that do not, threads are typically canceled through the action of a signal handler.<p>
As noted earlier, threads are considered running until the "Run" method returns, or until a cancellation request is made. Common C++ threads can control how they respond to cancellation, using setCancellation(). <a class="el" href="classost_1_1_cancellation.html">Cancellation</a> requests can be ignored, set to occur only when a cancellation "point" has been reached in the code, or occur immediately. Threads can also exit by returning from Run() or by invoking the Exit() method.<p>
Generally it is a good practice to initialize any resources the thread may require within the constructor of your derived thread class, and to purge or restore any allocated resources in the destructor. In most cases, the destructor will be executed after the thread has terminated, and hence will execute within the context of the thread that requested a join rather than in the context of the thread that is being terminated. Most destructors in derived thread classes should first call Terminate() to make sure the thread has stopped running before releasing resources.<p>
A Common C++ thread is normally canceled by deleting the thread object. The process of deletion invokes the thread's destructor, and the destructor will then perform a "join" against the thread using the Terminate() function. This behavior is not always desirable since the thread may block itself from cancellation and block the current "delete" operation from completing. One can alternately invoke Terminate() directly before deleting a thread object.<p>
When a given Common C++ thread exits on it's own through it's Run() method, a "Final" method will be called. This Final method will be called while the thread is "detached". If a thread object is constructed through a "new" operator, it's final method can be used to "self delete" when done, and allows an independent thread to construct and remove itself autonomously.<p>
A special global function, <a class="el" href="namespaceost.html#99c7f7d02b00922b0f5ee62fc3bb75fd">getThread()</a>, is provided to identify the thread object that represents the current execution context you are running under. This is sometimes needed to deliver signals to the correct thread. Since all thread manipulation should be done through the Common C++ (base) thread class itself, this provides the same functionality as things like "pthread_self" for Common C++.<p>
All Common C++ threads have an exception "mode" which determines their behavior when an exception is thrown by another Common C++ class. Extensions to Common C++ should respect the current exception mode and use <a class="el" href="classost_1_1_thread.html#0272b6a8de586ee5ee2464bbdb030392">getException()</a> to determine what to do when they are about to throw an object. The default exception mode (defined in the Thread() constructor) is throwObject, which causes a pointer to an instance of the class where the error occured to be thrown. Other exception modes are throwException, which causes a class-specific exception class to be thrown, and throwNothing, which causes errors to be ignored.<p>
As an example, you could try to call the <a class="el" href="classost_1_1_socket.html">Socket</a> class with an invalid address that the system could not bind to. This would cause an object of type <a class="el" href="classost_1_1_socket.html">Socket</a> * to be thrown by default, as the default exception mode is throwObject. If you call setException(throwException) before the bad call to the <a class="el" href="classost_1_1_socket.html">Socket</a> constructor, an object of type SockException (the exception class for class <a class="el" href="classost_1_1_socket.html">Socket</a>) will be thrown instead.<p>
To determine what exception class is thrown by a given Common C++ class when the exception mode is set to throwException, search the source files for the class you are interested in for a class which inherits directly or indirectly from class Exception. This is the exception class which would be thrown when the exception mode is set to throwException.<p>
The advantage of using throwException versus throwObject is that more information is available to the programmer from the thrown object. All class-specific exceptions inherit from class Exception, which provides a getString() method which can be called to get a human-readable error string.<p>
Common C++ threads are often aggregated into other classes to provide services that are "managed" from or operate within the context of a thread, even within the Common C++ framework itself. A good example of this is the <a class="el" href="classost_1_1_t_c_p_session.html">TCPSession</a> class, which essentially is a combination of a TCP client connection and a separate thread the user can define by deriving a class with a Run() method to handle the connected service. This aggregation logically connects the successful allocation of a given resource with the construction of a thread to manage and perform operations for said resource.<p>
Threads are also used in "service pools". In Common C++, a service pool is one or more threads that are used to manage a set of resources. While Common C++ does not provide a direct "pool" class, it does provide a model for their implementation, usually by constructing an array of thread "service" objects, each of which can then be assigned the next new instance of a given resource in turn or algorithmically.<p>
Threads have signal handlers associated with them. Several signal types are "predefined" and have special meaning. All signal handlers are defined as virtual member functions of the <a class="el" href="classost_1_1_thread.html">Thread</a> class which are called when a specific signal is received for a given thread. The "SIGPIPE" event is defined as a "Disconnect" event since it's normally associated with a socket disconnecting or broken fifo. The Hangup() method is associated with the SIGHUP signal. All other signals are handled through the more generic Signal().<p>
Incidently, unlike Posix, the win32 API has no concept of signals, and certainly no means to define or deliver signals on a per-thread basis. For this reason, no signal handling is supported or emulated in the win32 implementation of Common C++ at this time.<p>
In addition to <a class="el" href="classost_1_1_t_c_p_stream.html">TCPStream</a>, there is a <a class="el" href="classost_1_1_t_c_p_session.html">TCPSession</a> class which combines a thread with a <a class="el" href="classost_1_1_t_c_p_stream.html">TCPStream</a> object. The assumption made by <a class="el" href="classost_1_1_t_c_p_session.html">TCPSession</a> is that one will service each TCP connection with a separate thread, and this makes sense for systems where extended connections may be maintained and complex protocols are being used over TCP.<p>
<dl compact><dt><b>Author:</b></dt><dd>David Sugar &lt;<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>&gt; </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>

<p>
<a class="el" href="bug1_8cpp-example.html#_a0">bug1.cpp</a>, <a class="el" href="bug2_8cpp-example.html#_a2">bug2.cpp</a>, <a class="el" href="tcpservice_8cpp-example.html#_a61">tcpservice.cpp</a>, <a class="el" href="tcpstr1_8cpp-example.html#_a65">tcpstr1.cpp</a>, <a class="el" href="thread1_8cpp-example.html#_a88">thread1.cpp</a>, and <a class="el" href="thread2_8cpp-example.html#_a90">thread2.cpp</a>.</dl>
<p>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="0d876c60edcf92d3d96121aacea441d0"></a><!-- doxytag: member="ost::Thread::Cancel" ref="0d876c60edcf92d3d96121aacea441d0" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">typedef enum <a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">ost::Thread::Cancel</a>  <a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">ost::Thread::Cancel</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
How work cancellation. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="81069ba4a0bf16a0aa9f076aa725f0c1"></a><!-- doxytag: member="ost::Thread::Suspend" ref="81069ba4a0bf16a0aa9f076aa725f0c1" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">typedef enum <a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">ost::Thread::Suspend</a>  <a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">ost::Thread::Suspend</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
How work suspend. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="511f08b9f1aef08b4f02e2ad225960ab"></a><!-- doxytag: member="ost::Thread::Throw" ref="511f08b9f1aef08b4f02e2ad225960ab" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">typedef enum <a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">ost::Thread::Throw</a>  <a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">ost::Thread::Throw</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
How to raise error. 
<p>
    </td>
  </tr>
</table>
<hr><h2>Member Enumeration Documentation</h2>
<a class="anchor" name="24f333b09607b7c48a97e05865ada69b"></a><!-- doxytag: member="ost::Thread::Cancel" ref="24f333b09607b7c48a97e05865ada69b" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">enum <a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">ost::Thread::Cancel</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
How work cancellation. 
<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="24f333b09607b7c48a97e05865ada69bbbf14157c17311ec31f0967032ecb357"></a><!-- doxytag: member="cancelInitial" ref="24f333b09607b7c48a97e05865ada69bbbf14157c17311ec31f0967032ecb357" args="" -->cancelInitial</em>&nbsp;</td><td>
used internally, do not use </td></tr>
<tr><td valign="top"><em><a class="anchor" name="24f333b09607b7c48a97e05865ada69bb02b8cd8d899a693e8cbb86082f4ef16"></a><!-- doxytag: member="cancelDeferred" ref="24f333b09607b7c48a97e05865ada69bb02b8cd8d899a693e8cbb86082f4ef16" args="" -->cancelDeferred</em>&nbsp;</td><td>
exit thread on cancellation pointsuch as yield </td></tr>
<tr><td valign="top"><em><a class="anchor" name="24f333b09607b7c48a97e05865ada69b57f820ea4f7a326c27cc504a213e167d"></a><!-- doxytag: member="cancelImmediate" ref="24f333b09607b7c48a97e05865ada69b57f820ea4f7a326c27cc504a213e167d" args="" -->cancelImmediate</em>&nbsp;</td><td>
exit befor cancellation </td></tr>
<tr><td valign="top"><em><a class="anchor" name="24f333b09607b7c48a97e05865ada69be07cc9f6d3d7333c8cce543a8bb58215"></a><!-- doxytag: member="cancelDisabled" ref="24f333b09607b7c48a97e05865ada69be07cc9f6d3d7333c8cce543a8bb58215" args="" -->cancelDisabled</em>&nbsp;</td><td>
ignore cancellation </td></tr>
<tr><td valign="top"><em><a class="anchor" name="24f333b09607b7c48a97e05865ada69ba194b63cafc5387684afe7943fe3b5f0"></a><!-- doxytag: member="cancelManual" ref="24f333b09607b7c48a97e05865ada69ba194b63cafc5387684afe7943fe3b5f0" args="" -->cancelManual</em>&nbsp;</td><td>
unimplemented (working in progress) 
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000006">Todo:</a></b></dt><dd>implement </dd></dl>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="24f333b09607b7c48a97e05865ada69bdf753e6d700f194c1b8f695a9bd67554"></a><!-- doxytag: member="cancelDefault" ref="24f333b09607b7c48a97e05865ada69bdf753e6d700f194c1b8f695a9bd67554" args="" -->cancelDefault</em>&nbsp;</td><td>
default you should use this for compatibility instead of deferred </td></tr>
</table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="ff7bd364ce645eac95affbf74f1a7087"></a><!-- doxytag: member="ost::Thread::Suspend" ref="ff7bd364ce645eac95affbf74f1a7087" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">enum <a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">ost::Thread::Suspend</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
How work suspend. 
<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="ff7bd364ce645eac95affbf74f1a708727f2f61f4bc18b64e9c25f73bb008a38"></a><!-- doxytag: member="suspendEnable" ref="ff7bd364ce645eac95affbf74f1a708727f2f61f4bc18b64e9c25f73bb008a38" args="" -->suspendEnable</em>&nbsp;</td><td>
suspend enabled </td></tr>
<tr><td valign="top"><em><a class="anchor" name="ff7bd364ce645eac95affbf74f1a70870e9f14f0e69d8c12c36a46d108a5074b"></a><!-- doxytag: member="suspendDisable" ref="ff7bd364ce645eac95affbf74f1a70870e9f14f0e69d8c12c36a46d108a5074b" args="" -->suspendDisable</em>&nbsp;</td><td>
suspend disabled, Suspend do nothing </td></tr>
</table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="b9538e839c06104af2974b77d2a5674d"></a><!-- doxytag: member="ost::Thread::Throw" ref="b9538e839c06104af2974b77d2a5674d" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">enum <a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">ost::Thread::Throw</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
How to raise error. 
<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="b9538e839c06104af2974b77d2a5674d1b058025329425c90f383d124ee605e5"></a><!-- doxytag: member="throwNothing" ref="b9538e839c06104af2974b77d2a5674d1b058025329425c90f383d124ee605e5" args="" -->throwNothing</em>&nbsp;</td><td>
continue without throwing error </td></tr>
<tr><td valign="top"><em><a class="anchor" name="b9538e839c06104af2974b77d2a5674dea5957cd08cfecf17f366352bcf9ad80"></a><!-- doxytag: member="throwObject" ref="b9538e839c06104af2974b77d2a5674dea5957cd08cfecf17f366352bcf9ad80" args="" -->throwObject</em>&nbsp;</td><td>
throw object that cause error (throw this) </td></tr>
<tr><td valign="top"><em><a class="anchor" name="b9538e839c06104af2974b77d2a5674d8e51a6870e65238764becffff92d7f54"></a><!-- doxytag: member="throwException" ref="b9538e839c06104af2974b77d2a5674d8e51a6870e65238764becffff92d7f54" args="" -->throwException</em>&nbsp;</td><td>
throw an object relative to error </td></tr>
</table>
</dl>
    </td>
  </tr>
</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="72470c1b00d098e74162284e248c0435"></a><!-- doxytag: member="ost::Thread::Thread" ref="72470c1b00d098e74162284e248c0435" args="(bool isMain)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">ost::Thread::Thread           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">bool&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>isMain</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This is actually a special constructor that is used to create a thread "object" for the current execution context when that context is not created via an instance of a derived <a class="el" href="classost_1_1_thread.html">Thread</a> object itself. 
<p>
This constructor does not support First.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>isMain</em>&nbsp;</td><td>bool used if the main "thread" of the application. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="082ea94f104219969a2d75becc749af6"></a><!-- doxytag: member="ost::Thread::Thread" ref="082ea94f104219969a2d75becc749af6" args="(int pri=0, size_t stack=0)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">ost::Thread::Thread           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap> <em>pri</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap> <em>stack</em> = <code>0</code></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
When a thread object is contructed, a new thread of execution context is created. 
<p>
This constructor allows basic properties of that context (thread priority, stack space, etc) to be defined. The starting condition is also specified for whether the thread is to wait on a semaphore before begining execution or wait until it's start method is called.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pri</em>&nbsp;</td><td>thread base priority relative to it's parent. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stack</em>&nbsp;</td><td>space as needed in some implementations. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="0ba7f4211aabb5a278c546d0fae81f55"></a><!-- doxytag: member="ost::Thread::Thread" ref="0ba7f4211aabb5a278c546d0fae81f55" args="(const Thread &amp;th)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">ost::Thread::Thread           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="classost_1_1_thread.html">Thread</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>th</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
A thread of execution can also be specified by cloning an existing thread. 
<p>
The existing thread's properties (cancel mode, priority, etc), are also duplicated.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>th</em>&nbsp;</td><td>currently executing thread object to clone. </td></tr>
  </table>
</dl>
<dl compact><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>implement in win32 </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="d363397f26006af68fa9315c9bff8589"></a><!-- doxytag: member="ost::Thread::~Thread" ref="d363397f26006af68fa9315c9bff8589" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual ost::Thread::~Thread           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The thread destructor should clear up any resources that have been allocated by the thread. 
<p>
The desctructor of a derived thread should begin with Terminate() and is presumed to then execute within the context of the thread causing terminaton.     </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="5e574c2c5f388277527c9257524dd654"></a><!-- doxytag: member="ost::Thread::clrParent" ref="5e574c2c5f388277527c9257524dd654" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::clrParent           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline, protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
clear parent thread relationship. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="c30778f0fffd9dd952fd73cb541cc70b"></a><!-- doxytag: member="ost::Thread::detach" ref="c30778f0fffd9dd952fd73cb541cc70b" args="(Semaphore *start=0)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">int ost::Thread::detach           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_semaphore.html">Semaphore</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>start</em> = <code>0</code>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Start a new thread as "detached". 
<p>
This is an alternative <a class="el" href="classost_1_1_thread.html#2ef198d7aefb93cf9de4fcc6b66c27a2">start()</a> method that resolves some issues with later glibc implimentations which incorrectly impliment self-detach.<p>
<dl compact><dt><b>Returns:</b></dt><dd>error code if execution fails. </dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>start</em>&nbsp;</td><td>optional starting semaphore to alternately use. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="thread2_8cpp-example.html#a92">thread2.cpp</a>.</dl>    </td>
  </tr>
</table>
<a class="anchor" name="599880181a0aeaef8a0ddedeeceddb9a"></a><!-- doxytag: member="ost::Thread::enterCancel" ref="599880181a0aeaef8a0ddedeeceddb9a" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static <a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a> ost::Thread::enterCancel           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This is used to help build wrapper functions in libraries around system calls that should behave as cancellation points but don't. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>saved cancel type. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="cd315d7c877b346970680d739da3e994"></a><!-- doxytag: member="ost::Thread::exit" ref="cd315d7c877b346970680d739da3e994" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::exit           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Used to properly exit from a <a class="el" href="classost_1_1_thread.html">Thread</a> derived <a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run()</a> or <a class="el" href="classost_1_1_thread.html#300c229e76725eeddc69867f7ecea91f">initial()</a> method. 
<p>
Terminates execution of the current thread and calls the derived classes <a class="el" href="classost_1_1_thread.html#6fb521eb3d23c51925472a3fe0abf327">final()</a> method. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="bug2_8cpp-example.html#a3">bug2.cpp</a>, and <a class="el" href="tcpservice_8cpp-example.html#a63">tcpservice.cpp</a>.</dl>    </td>
  </tr>
</table>
<a class="anchor" name="bcad222419e4106ac21ce12605eb4fe7"></a><!-- doxytag: member="ost::Thread::exitCancel" ref="bcad222419e4106ac21ce12605eb4fe7" args="(Cancel cancel)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static void ost::Thread::exitCancel           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>cancel</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This is used to restore a cancel block. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>cancel</em>&nbsp;</td><td>type that was saved. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="6fb521eb3d23c51925472a3fe0abf327"></a><!-- doxytag: member="ost::Thread::final" ref="6fb521eb3d23c51925472a3fe0abf327" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void ost::Thread::final           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected, virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
A thread that is self terminating, either by invoking <a class="el" href="classost_1_1_thread.html#cd315d7c877b346970680d739da3e994">exit()</a> or leaving it's <a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run()</a>, will have this method called. 
<p>
It can be used to self delete the current object assuming the object was created with new on the heap rather than stack local, hence one may often see final defined as "delete this" in a derived thread class. A final method, while running, cannot be terminated or cancelled by another thread. Final is called for all cancellation type (even immediate).<p>
You can safe delete thread ("delete this") class on final, but you should exit ASAP (or do not try to call CommonC++ methods...)<p>
<dl compact><dt><b>Note:</b></dt><dd>A thread cannot delete its own context or join itself. To make a thread that is a self running object that self-deletes, one has to detach the thread by using <a class="el" href="classost_1_1_thread.html#c30778f0fffd9dd952fd73cb541cc70b">detach()</a> instead of <a class="el" href="classost_1_1_thread.html#2ef198d7aefb93cf9de4fcc6b66c27a2">start()</a>.</dd></dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classost_1_1_thread.html#cd315d7c877b346970680d739da3e994">exit</a> <p>
<a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run</a> </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="tcpthread_8cpp-example.html#a83">tcpthread.cpp</a>.</dl>    </td>
  </tr>
</table>
<a class="anchor" name="aad41a9f7962bdc3058a429df48246fd"></a><!-- doxytag: member="ost::Thread::get" ref="aad41a9f7962bdc3058a429df48246fd" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static <a class="el" href="classost_1_1_thread.html">Thread</a>* ost::Thread::get           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="3524521d80bcc0562fb59a28ce5d62a4"></a><!-- doxytag: member="ost::Thread::getCancel" ref="3524521d80bcc0562fb59a28ce5d62a4" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a> ost::Thread::getCancel           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Used to retrieve the cancellation mode in effect for the selected thread. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>cancellation mode constant. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="0272b6a8de586ee5ee2464bbdb030392"></a><!-- doxytag: member="ost::Thread::getException" ref="0272b6a8de586ee5ee2464bbdb030392" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static <a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">Throw</a> ost::Thread::getException           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get exception mode of the current thread. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>exception mode. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="b73c94e3ca46cb24f4246e71fff73026"></a><!-- doxytag: member="ost::Thread::getExtended" ref="b73c94e3ca46cb24f4246e71fff73026" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void* ost::Thread::getExtended           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected, virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Since <a class="el" href="classost_1_1_thread.html#ac5bc230c3bad5c837baa9e6d01f4c24">getParent()</a> and <a class="el" href="namespaceost.html#99c7f7d02b00922b0f5ee62fc3bb75fd">getThread()</a> only refer to an object of the <a class="el" href="classost_1_1_thread.html">Thread</a> "base" type, this virtual method can be replaced in a derived class with something that returns data specific to the derived class that can still be accessed through the pointer returned by <a class="el" href="classost_1_1_thread.html#ac5bc230c3bad5c837baa9e6d01f4c24">getParent()</a> and <a class="el" href="namespaceost.html#99c7f7d02b00922b0f5ee62fc3bb75fd">getThread()</a>. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>pointer to derived class specific data. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="3947a150139cf226626f47166ff92286"></a><!-- doxytag: member="ost::Thread::getId" ref="3947a150139cf226626f47166ff92286" args="(void) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="thread_8h.html#3f0d0226a694bf1e508e1b1c758e6ae6">cctid_t</a> ost::Thread::getId           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get system thread numeric identifier. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>numeric identifier of this thread. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="e78f5d3f965bff1b6aa4ae6dacc5cc35"></a><!-- doxytag: member="ost::Thread::getName" ref="e78f5d3f965bff1b6aa4ae6dacc5cc35" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">const char* ost::Thread::getName           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the name string for this thread, to use in debug messages. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>debug name. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="ac5bc230c3bad5c837baa9e6d01f4c24"></a><!-- doxytag: member="ost::Thread::getParent" ref="ac5bc230c3bad5c837baa9e6d01f4c24" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html">Thread</a>* ost::Thread::getParent           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Gets the pointer to the <a class="el" href="classost_1_1_thread.html">Thread</a> class which created the current thread object. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>a <a class="el" href="classost_1_1_thread.html">Thread</a> *, or "(Thread *)this" if no parent. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="300c229e76725eeddc69867f7ecea91f"></a><!-- doxytag: member="ost::Thread::initial" ref="300c229e76725eeddc69867f7ecea91f" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void ost::Thread::initial           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected, virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The initial method is called by a newly created thread when it starts execution. 
<p>
This method is ran with deferred cancellation disabled by default. The Initial method is given a separate handler so that it can create temporary objects on it's own stack frame, rather than having objects created on <a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run()</a> that are only needed by startup and yet continue to consume stack space.<p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classost_1_1_thread.html#dd7d339d94b8a1ed2b2b0324a95b7e74">run</a> <p>
<a class="el" href="classost_1_1_thread.html#6fb521eb3d23c51925472a3fe0abf327">final</a> </dd></dl>

<p>
Reimplemented in <a class="el" href="classost_1_1_t_c_p_session.html#d0a0568018d48cc3079222156a6af093">ost::TCPSession</a>, and <a class="el" href="classost_1_1_unix_session.html#5762091d1418fca6b4970c9c5a5b347f">ost::UnixSession</a>.    </td>
  </tr>
</table>
<a class="anchor" name="fab1a3194f6c0753748584a6c68e8e28"></a><!-- doxytag: member="ost::Thread::isDetached" ref="fab1a3194f6c0753748584a6c68e8e28" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">bool ost::Thread::isDetached           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Check if this thread is detached. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>true if the thread is detached. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="16f6de1f41e82c6edee5465922dfe5ab"></a><!-- doxytag: member="ost::Thread::isRunning" ref="16f6de1f41e82c6edee5465922dfe5ab" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">bool ost::Thread::isRunning           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Verifies if the thread is still running or has already been terminated but not yet deleted. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>true if the thread is still executing. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="c25f1fcbb5f0cb2e683d746c94b255f6"></a><!-- doxytag: member="ost::Thread::isThread" ref="c25f1fcbb5f0cb2e683d746c94b255f6" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">bool ost::Thread::isThread           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Tests to see if the current execution context is the same as the specified thread object. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>true if the current context is this object. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="1e6d355ea0d9b0b023f3fc2aa91a25e8"></a><!-- doxytag: member="ost::Thread::join" ref="1e6d355ea0d9b0b023f3fc2aa91a25e8" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::join           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Blocking call which unlocks when thread terminates. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="390827ad98d3402dd84ee9f128bcd564"></a><!-- doxytag: member="ost::Thread::notify" ref="390827ad98d3402dd84ee9f128bcd564" args="(Thread *)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void ost::Thread::notify           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html">Thread</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected, virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
When a thread terminates, it now sends a notification message to the parent thread which created it. 
<p>
The actual use of this notification is left to be defined in a derived class.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>-</em>&nbsp;</td><td>the thread that has terminated. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="0861f734ad77b1ba517fce302215e41e"></a><!-- doxytag: member="ost::Thread::resume" ref="0861f734ad77b1ba517fce302215e41e" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::resume           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Resumes execution of the selected thread. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="dd7d339d94b8a1ed2b2b0324a95b7e74"></a><!-- doxytag: member="ost::Thread::run" ref="dd7d339d94b8a1ed2b2b0324a95b7e74" args="(void)=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void ost::Thread::run           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected, pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
All threads execute by deriving the Run method of <a class="el" href="classost_1_1_thread.html">Thread</a>. 
<p>
This method is called after Initial to begin normal operation of the thread. If the method terminates, then the thread will also terminate after notifying it's parent and calling it's Final() method.<p>
<dl compact><dt><b>See also:</b></dt><dd>Initial </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="bug1_8cpp-example.html#a1">bug1.cpp</a>, <a class="el" href="bug2_8cpp-example.html#a4">bug2.cpp</a>, <a class="el" href="tcpservice_8cpp-example.html#a62">tcpservice.cpp</a>, <a class="el" href="tcpstr1_8cpp-example.html#a67">tcpstr1.cpp</a>, <a class="el" href="tcpthread_8cpp-example.html#a80">tcpthread.cpp</a>, <a class="el" href="thread1_8cpp-example.html#a89">thread1.cpp</a>, and <a class="el" href="thread2_8cpp-example.html#a91">thread2.cpp</a>.</dl>    </td>
  </tr>
</table>
<a class="anchor" name="4bff373a83b90f6f44d1519ef893e35b"></a><!-- doxytag: member="ost::Thread::setCancel" ref="4bff373a83b90f6f44d1519ef893e35b" args="(Cancel mode)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::setCancel           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html#0d876c60edcf92d3d96121aacea441d0">Cancel</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>mode</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Sets thread cancellation mode. 
<p>
Threads can either be set immune to termination (cancelDisabled), can be set to terminate when reaching specific "thread cancellation points" (cancelDeferred) or immediately when Terminate is requested (cancelImmediate).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>mode</em>&nbsp;</td><td>for cancellation of the current thread. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="e9f30b27ca1322ccc3325ba9ca5157fa"></a><!-- doxytag: member="ost::Thread::setException" ref="e9f30b27ca1322ccc3325ba9ca5157fa" args="(Throw mode)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static void ost::Thread::setException           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html#511f08b9f1aef08b4f02e2ad225960ab">Throw</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>mode</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set exception mode of the current thread. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>exception mode. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="b6f72653183c4db0dfd6b254ddbf072e"></a><!-- doxytag: member="ost::Thread::setName" ref="b6f72653183c4db0dfd6b254ddbf072e" args="(const char *text)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::setName           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>text</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set the name of the current thread. 
<p>
If the name is passed as NULL, then the default name is set (usually object pointer).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>text</em>&nbsp;</td><td>name to use. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="ccd29b724539d63a8495d954f9f56c72"></a><!-- doxytag: member="ost::Thread::setStack" ref="ccd29b724539d63a8495d954f9f56c72" args="(size_t size=0)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static void ost::Thread::setStack           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>size</em> = <code>0</code>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline, static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set base stack limit before manual stack sizes have effect. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>stack size to set, or use 0 to clear autostack. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="d226f8bca85bf68ce71d90baca6434d6"></a><!-- doxytag: member="ost::Thread::setSuspend" ref="d226f8bca85bf68ce71d90baca6434d6" args="(Suspend mode)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::setSuspend           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html#81069ba4a0bf16a0aa9f076aa725f0c1">Suspend</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>mode</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Sets the thread's ability to be suspended from execution. 
<p>
The thread may either have suspend enabled (suspendEnable) or disabled (suspendDisable).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>mode</em>&nbsp;</td><td>for suspend. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="663d960e8599194f3b25169915c22fb6"></a><!-- doxytag: member="ost::Thread::sleep" ref="663d960e8599194f3b25169915c22fb6" args="(timeout_t msec)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static void ost::Thread::sleep           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="thread_8h.html#f412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>msec</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
A thread-safe sleep call. 
<p>
On most Posix systems, "sleep()" is implimented with SIGALRM making it unusable from multipe threads. Pthread libraries often define an alternate "sleep" handler such as usleep(), nanosleep(), or nap(), that is thread safe, and also offers a higher timer resolution.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>msec</em>&nbsp;</td><td>timeout in milliseconds. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="2ef198d7aefb93cf9de4fcc6b66c27a2"></a><!-- doxytag: member="ost::Thread::start" ref="2ef198d7aefb93cf9de4fcc6b66c27a2" args="(Semaphore *start=0)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">int ost::Thread::start           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_semaphore.html">Semaphore</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>start</em> = <code>0</code>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
When a new thread is created, it does not begin immediate execution. 
<p>
This is because the derived class virtual tables are not properly loaded at the time the C++ object is created within the constructor itself, at least in some compiler/system combinations. The thread can either be told to wait for an external semaphore, or it can be started directly after the constructor completes by calling the <a class="el" href="classost_1_1_thread.html#2ef198d7aefb93cf9de4fcc6b66c27a2">start()</a> method.<p>
<dl compact><dt><b>Returns:</b></dt><dd>error code if execution fails. </dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>start</em>&nbsp;</td><td>optional starting semaphore to alternately use. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="tcpservice_8cpp-example.html#a64">tcpservice.cpp</a>, and <a class="el" href="tcpstr1_8cpp-example.html#a66">tcpstr1.cpp</a>.</dl>    </td>
  </tr>
</table>
<a class="anchor" name="5f1b650c1f3b71e458adfbd86b3acb83"></a><!-- doxytag: member="ost::Thread::suspend" ref="5f1b650c1f3b71e458adfbd86b3acb83" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::suspend           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Suspends execution of the selected thread. 
<p>
Pthreads do not normally support suspendable threads, so the behavior is simulated with signals. On systems such as Linux that define threads as processes, SIGSTOP and SIGCONT may be used.     </td>
  </tr>
</table>
<a class="anchor" name="1cda4748073c4d55e2d0504e7c9b09cc"></a><!-- doxytag: member="ost::Thread::sync" ref="1cda4748073c4d55e2d0504e7c9b09cc" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::sync           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Used to wait for a join or cancel, in place of explicit exit. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="e71c94c24733ed82f9b74c034744d002"></a><!-- doxytag: member="ost::Thread::terminate" ref="e71c94c24733ed82f9b74c034744d002" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void ost::Thread::terminate           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Used by another thread to terminate the current thread. 
<p>
Termination actually occurs based on the current <a class="el" href="classost_1_1_thread.html#4bff373a83b90f6f44d1519ef893e35b">setCancel()</a> mode. When the current thread does terminate, control is returned to the requesting thread. <a class="el" href="classost_1_1_thread.html#e71c94c24733ed82f9b74c034744d002">terminate()</a> should always be called at the start of any destructor of a class derived from <a class="el" href="classost_1_1_thread.html">Thread</a> to assure the remaining part of the destructor is called without the thread still executing.     </td>
  </tr>
</table>
<a class="anchor" name="f8afe7a3330b69dff685415aae14657c"></a><!-- doxytag: member="ost::Thread::testCancel" ref="f8afe7a3330b69dff685415aae14657c" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">bool ost::Thread::testCancel           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
test a cancellation point for deferred thread cancellation. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="3f4a4f9872ed8f80a591e6b020ecf5d7"></a><!-- doxytag: member="ost::Thread::yield" ref="3f4a4f9872ed8f80a591e6b020ecf5d7" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static void ost::Thread::yield           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Yields the current thread's CPU time slice to allow another thread to begin immediate execution. 
<p>
    </td>
  </tr>
</table>
<hr><h2>Friends And Related Function Documentation</h2>
<a class="anchor" name="bbf97e2c58c760acb67b9db3a7ba11db"></a><!-- doxytag: member="ost::Thread::Cancellation" ref="bbf97e2c58c760acb67b9db3a7ba11db" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">friend class <a class="el" href="classost_1_1_cancellation.html">Cancellation</a><code> [friend]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="9b6e94561c96e07e8f2dd776bbc19396"></a><!-- doxytag: member="ost::Thread::DummyThread" ref="9b6e94561c96e07e8f2dd776bbc19396" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">friend class DummyThread<code> [friend]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="2742c471d2abe8712368ccff8d534702"></a><!-- doxytag: member="ost::Thread::operator++" ref="2742c471d2abe8712368ccff8d534702" args="(Thread &amp;th)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void operator++           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html">Thread</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>th</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [friend]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Signal the semaphore that the specified thread is waiting for before beginning execution. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>th</em>&nbsp;</td><td>specified thread. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a797f8e5a1ea5b857251f98f0d50614e"></a><!-- doxytag: member="ost::Thread::operator--" ref="a797f8e5a1ea5b857251f98f0d50614e" args="(Thread &amp;th)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void operator--           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread.html">Thread</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>th</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [friend]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="bc1a729c4204bc85f58c47042f429acb"></a><!-- doxytag: member="ost::Thread::PosixThread" ref="bc1a729c4204bc85f58c47042f429acb" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">friend class <a class="el" href="classost_1_1_posix_thread.html">PosixThread</a><code> [friend]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="e156bb5074cfe5c3a729890e0ded952f"></a><!-- doxytag: member="ost::Thread::postream_type" ref="e156bb5074cfe5c3a729890e0ded952f" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">friend class postream_type<code> [friend]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="f08013a89bf19b835ba6f75a60f870ed"></a><!-- doxytag: member="ost::Thread::Slog" ref="f08013a89bf19b835ba6f75a60f870ed" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">friend class <a class="el" href="classost_1_1_slog.html">Slog</a><code> [friend]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="e3c1cdb20d70b22a5c0bf395614eefff"></a><!-- doxytag: member="ost::Thread::ThreadImpl" ref="e3c1cdb20d70b22a5c0bf395614eefff" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">friend class ThreadImpl<code> [friend]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Reimplemented in <a class="el" href="classost_1_1_posix_thread.html#e3c1cdb20d70b22a5c0bf395614eefff">ost::PosixThread</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="thread_8h-source.html">thread.h</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 19 10:50:57 2006 for GNU CommonC++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
</body>
</html>