Files
stk/doc/html/classstk_1_1Thread.html
2013-09-29 23:44:33 +02:00

172 lines
9.5 KiB
HTML

<HTML>
<HEAD>
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="faq.html">FAQ</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1Thread.html">Thread</a>
</div>
<div class="contents">
<h1>stk::Thread Class Reference</h1><!-- doxytag: class="stk::Thread" --><!-- doxytag: inherits="stk::Stk" -->STK thread class.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="Thread_8h-source.html">Thread.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for stk::Thread:</div>
<div class="dynsection">
<p><center><img src="classstk_1_1Thread.png" usemap="#stk::Thread_map" border="0" alt=""></center>
<map name="stk::Thread_map">
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,73,24">
</map>
</div>
<p>
<a href="classstk_1_1Thread-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 Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="550db7efe16cd4ef223d9ca69dda384b"></a><!-- doxytag: member="stk::Thread::Thread" ref="550db7efe16cd4ef223d9ca69dda384b" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Thread.html#550db7efe16cd4ef223d9ca69dda384b">Thread</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f3a6c8bcfebeeda352286f46afda00b3"></a><!-- doxytag: member="stk::Thread::~Thread" ref="f3a6c8bcfebeeda352286f46afda00b3" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Thread.html#f3a6c8bcfebeeda352286f46afda00b3">~Thread</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The class destructor does not attempt to cancel or join a thread. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Thread.html#bcafe21595d9c6ac52b1ae872b34a531">start</a> (THREAD_FUNCTION routine, void *ptr=NULL)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Begin execution of the thread <em>routine</em>. Upon success, true is returned. <a href="#bcafe21595d9c6ac52b1ae872b34a531"></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="classstk_1_1Thread.html#7187695295a7e5faf780ca13b0c07d4e">cancel</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Signal cancellation of a thread routine, returning <em>true</em> on success. <a href="#7187695295a7e5faf780ca13b0c07d4e"></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="classstk_1_1Thread.html#cce21fd2b9b62cd8116fefe499c8431f">wait</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Block the calling routine indefinitely until the thread terminates. <a href="#cce21fd2b9b62cd8116fefe499c8431f"></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="classstk_1_1Thread.html#351cf3ad12622606ea2d984ae2e29380">testCancel</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a cancellation point within a thread routine. <a href="#351cf3ad12622606ea2d984ae2e29380"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
STK thread class.
<p>
This class provides a uniform interface for cross-platform threads. On unix systems, the pthread library is used. Under Windows, the C runtime threadex functions are used.<p>
Each instance of the <a class="el" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> class can be used to control a single thread process. Routines are provided to signal cancelation and/or joining with a thread, though it is not possible for this class to know the running status of a thread once it is started.<p>
For cross-platform compatability, thread functions should be declared as follows:<p>
THREAD_RETURN THREAD_TYPE thread_function(void *ptr)<p>
by Perry R. Cook and Gary P. Scavone, 1995 - 2009. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="bcafe21595d9c6ac52b1ae872b34a531"></a><!-- doxytag: member="stk::Thread::start" ref="bcafe21595d9c6ac52b1ae872b34a531" args="(THREAD_FUNCTION routine, void *ptr=NULL)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool stk::Thread::start </td>
<td>(</td>
<td class="paramtype">THREAD_FUNCTION&nbsp;</td>
<td class="paramname"> <em>routine</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>ptr</em> = <code>NULL</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Begin execution of the thread <em>routine</em>. Upon success, true is returned.
<p>
A data pointer can be supplied to the thread routine via the optional <em>ptr</em> argument. If the thread cannot be created, the return value is false.
</div>
</div><p>
<a class="anchor" name="7187695295a7e5faf780ca13b0c07d4e"></a><!-- doxytag: member="stk::Thread::cancel" ref="7187695295a7e5faf780ca13b0c07d4e" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool stk::Thread::cancel </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Signal cancellation of a thread routine, returning <em>true</em> on success.
<p>
This function only signals thread cancellation. It does not wait to verify actual routine termination. A <em>true</em> return value only signifies that the cancellation signal was properly executed, not thread cancellation. A thread routine may need to make use of the <a class="el" href="classstk_1_1Thread.html#351cf3ad12622606ea2d984ae2e29380" title="Create a cancellation point within a thread routine.">testCancel()</a> function to specify a cancellation point.
</div>
</div><p>
<a class="anchor" name="cce21fd2b9b62cd8116fefe499c8431f"></a><!-- doxytag: member="stk::Thread::wait" ref="cce21fd2b9b62cd8116fefe499c8431f" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool stk::Thread::wait </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Block the calling routine indefinitely until the thread terminates.
<p>
This function suspends execution of the calling routine until the thread has terminated. It will return immediately if the thread was already terminated. A <em>true</em> return value signifies successful termination. A <em>false</em> return value indicates a problem with the wait call.
</div>
</div><p>
<a class="anchor" name="351cf3ad12622606ea2d984ae2e29380"></a><!-- doxytag: member="stk::Thread::testCancel" ref="351cf3ad12622606ea2d984ae2e29380" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Thread::testCancel </td>
<td>(</td>
<td class="paramtype">void&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Create a cancellation point within a thread routine.
<p>
This function call checks for thread cancellation, allowing the thread to be terminated if a cancellation request was previously signaled.
</div>
</div><p>
<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>
</div>
<HR>
<table>
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>&copy;1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>