Remove dependency on Boost::Thread and use the TinyThread library instead.

This saves the need to install Boost::Thread on each of the build systems.
This commit is contained in:
Robert Knight 2011-08-22 14:00:00 +01:00
parent d295b0323c
commit 5360d05867
57 changed files with 7715 additions and 6 deletions

View file

@ -3,9 +3,11 @@ project(updater)
cmake_minimum_required(VERSION 2.6)
include_directories(external)
include_directories(external/TinyThread/source)
add_subdirectory(src)
add_subdirectory(external/AnyOption)
add_subdirectory(external/minizip)
add_subdirectory(external/tinyxml)
add_subdirectory(external/TinyThread)

8
external/TinyThread/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,8 @@
project(tinythread)
cmake_minimum_required(VERSION 2.6)
add_library(tinythread
source/tinythread.cpp
)

126
external/TinyThread/README.txt vendored Normal file
View file

@ -0,0 +1,126 @@
TinyThread++ v1.0
=================
http://tinythread.sourceforge.net
About
-----
TinyThread++ is a minimalist, portable, threading library for C++, intended to
make it easy to create multi threaded C++ applications.
The library is closesly modeled after the current C++0x standard (draft), but
only a subset is implemented at the moment.
See the documentation in the doc/html directory for more information.
Using TinyThread++
------------------
To use TinyThread++ in your own project, just add tinythread.cpp and
tinythread.h to your project. In your own code, do:
#include <tinythread.h>
using namespace tthread;
If you wish to use the fast_mutex class, inlude fast_mutex.h:
#include <fast_mutex.h>
Building the test programs
--------------------------
From the test folder, issue one of the following commands:
Linux, Mac OS X, OpenSolaris etc:
make (you may need to use gmake on some systems)
Windows/MinGW:
mingw32-make
Windows/MS Visual Studio:
nmake /f Makefile.msvc
History
-------
v1.0 - 2010.10.01
- First non-beta release.
- Made mutex non-recursive (according to spec), and added recursive_mutex.
- General class, code & documentation improvements.
- Added a Makefile for MS Visual Studio.
v0.9 - 2010.08.10
- Added preliminary support for this_thread::sleep_for().
v0.8 - 2010.07.02
- Switched from CreateThread() to _beginthreadex() for Win32 (should fix
tiny memory leaks).
- Better standards compliance and some code cleanup.
v0.7 - 2010.05.17
- Added this_thread::yield().
- Replaced the non-standard number_of_processors() function with
thread::hardware_concurrency(), which is part of the C++0x draft.
- The thread::id() class is now more standards compliant (correct namespace
and comparison operators).
v0.6 - 2010.04.28
- Added a fast_mutex class (in fast_mutex.h).
- Made the test.cpp application compile under Mac OS X and MinGW/g++ 3.x.
v0.5 - 2010.03.31
- Added the thread_local keyword (support for thread-local storage).
- Added a test application to test the API (test.cpp).
- Improved the Doxygen documentation.
v0.4 - 2010.03.27
- Added thread::get_id() and this_thread::get_id().
- Changed the namespace name from tinythread to tthread.
v0.3 - 2010.03.24
- Fixed a compiler error for fractal.cpp under MS Visual C++.
- Added colors to the fractal generator.
v0.2 - 2010.03.23
- Better C++0x conformance.
- Better documentation.
- New classes:
- lock_guard
- New member functions:
- thread::joinable()
- thread::native_handle()
- mutex::try_lock()
- Added a multi threaded fractal generator test application.
v0.1 - 2010.03.21
- Initial release.
License
-------
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.

1510
external/TinyThread/doc/Doxyfile vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>Class List</h1>Here are the classes, structs, unions and interfaces with brief descriptions:<table>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td><td class="indexvalue">Condition variable class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1chrono_1_1duration.html">duration&lt; _Rep, _Period &gt;</a></td><td class="indexvalue">Duration template class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td><td class="indexvalue">Fast mutex class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1thread_1_1id.html">id</a></td><td class="indexvalue">Thread ID </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1lock__guard.html">lock_guard&lt; T &gt;</a></td><td class="indexvalue">Lock guard class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1mutex.html">mutex</a></td><td class="indexvalue">Mutex class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1ratio.html">ratio&lt; N, D &gt;</a></td><td class="indexvalue">Minimal implementation of the <code>ratio</code> class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td><td class="indexvalue">Recursive mutex class </td></tr>
<tr><td class="indexkey"><a class="el" href="classtthread_1_1thread.html">thread</a></td><td class="indexvalue">Thread class </td></tr>
</table>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,44 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Alphabetical List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>Class Index</h1><div class="qindex"><a class="qindex" href="#letter_C">C</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_D">D</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_F">F</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_I">I</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_L">L</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_M">M</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_R">R</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_T">T</a></div>
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
<tr><td><a name="letter_C"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;C&nbsp;&nbsp;</div></td></tr></table>
</td><td><a name="letter_F"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;F&nbsp;&nbsp;</div></td></tr></table>
</td><td><a name="letter_L"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;L&nbsp;&nbsp;</div></td></tr></table>
</td><td><a class="el" href="classtthread_1_1mutex.html">mutex</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="classtthread_1_1lock__guard.html">lock_guard</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td><td><a name="letter_R"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;R&nbsp;&nbsp;</div></td></tr></table>
</td><td><a name="letter_T"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;T&nbsp;&nbsp;</div></td></tr></table>
</td></tr><tr><td><a name="letter_D"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;D&nbsp;&nbsp;</div></td></tr></table>
</td><td><a name="letter_I"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;I&nbsp;&nbsp;</div></td></tr></table>
</td><td><a name="letter_M"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;M&nbsp;&nbsp;</div></td></tr></table>
</td><td><a class="el" href="classtthread_1_1ratio.html">ratio</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="classtthread_1_1thread.html">thread</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a> (<a class="el" href="namespacetthread_1_1chrono.html">tthread::chrono</a>)&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="classtthread_1_1thread_1_1id.html">thread::id</a> (<a class="el" href="namespacetthread.html">tthread</a>)&nbsp;&nbsp;&nbsp;</td></tr></table><div class="qindex"><a class="qindex" href="#letter_C">C</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_D">D</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_F">F</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_I">I</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_L">L</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_M">M</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_R">R</a>&nbsp;|&nbsp;<a class="qindex" href="#letter_T">T</a></div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>duration&lt; _Rep, _Period &gt; Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration&lt; _Rep, _Period &gt;</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020">count</a>() const </td><td><a class="el" href="classtthread_1_1chrono_1_1duration.html">duration&lt; _Rep, _Period &gt;</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1chrono_1_1duration.html#a5d86b0d68c98b74e3a6e541c1759ef3e">duration</a>(const _Rep2 &amp;r)</td><td><a class="el" href="classtthread_1_1chrono_1_1duration.html">duration&lt; _Rep, _Period &gt;</a></td><td><code> [inline, explicit]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: duration&lt; _Rep, _Period &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="namespacetthread_1_1chrono.html">chrono</a>::<a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>
</div>
</div>
<div class="contents">
<h1>duration&lt; _Rep, _Period &gt; Class Template Reference</h1><!-- doxytag: class="tthread::chrono::duration" -->
<p>Duration template class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1chrono_1_1duration-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memTemplParams" colspan="2"><a class="anchor" id="a5d86b0d68c98b74e3a6e541c1759ef3e"></a><!-- doxytag: member="tthread::chrono::duration::duration" ref="a5d86b0d68c98b74e3a6e541c1759ef3e" args="(const _Rep2 &amp;r)" -->
template&lt;class _Rep2 &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtthread_1_1chrono_1_1duration.html#a5d86b0d68c98b74e3a6e541c1759ef3e">duration</a> (const _Rep2 &amp;r)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct a duration object with the given duration. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3f01111f479d27be202983aacb03c020"></a><!-- doxytag: member="tthread::chrono::duration::count" ref="a3f01111f479d27be202983aacb03c020" args="() const " -->
rep&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020">count</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the value of the duration object. <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class _Rep, class _Period = ratio&lt;1&gt;&gt;<br/>
class tthread::chrono::duration&lt; _Rep, _Period &gt;</h3>
<p>Duration template class. </p>
<p>This class provides enough functionality to implement <code><a class="el" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398" title="Blocks the calling thread for a period of time.">this_thread::sleep_for()</a></code>. </p>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>condition_variable Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9">condition_variable</a>()</td><td><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326">notify_all</a>()</td><td><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394">notify_one</a>()</td><td><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1condition__variable.html#a4d877d804385bde4aacf2156e86faede">wait</a>(_mutexT &amp;aMutex)</td><td><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b">~condition_variable</a>()</td><td><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td><td><code> [inline]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,154 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: condition_variable Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a>
</div>
</div>
<div class="contents">
<h1>condition_variable Class Reference</h1><!-- doxytag: class="tthread::condition_variable" -->
<p>Condition variable class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1condition__variable-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9e62a1d1145c820a02469a48099fdfa9"></a><!-- doxytag: member="tthread::condition_variable::condition_variable" ref="a9e62a1d1145c820a02469a48099fdfa9" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9">condition_variable</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a58df09046f5006d4170ae92717f1e50b"></a><!-- doxytag: member="tthread::condition_variable::~condition_variable" ref="a58df09046f5006d4170ae92717f1e50b" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b">~condition_variable</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;class _mutexT &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html#a4d877d804385bde4aacf2156e86faede">wait</a> (_mutexT &amp;aMutex)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wait for the condition. <a href="#a4d877d804385bde4aacf2156e86faede"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394">notify_one</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Notify one thread that is waiting for the condition. <a href="#a84c2ec0dd971c593883198a323eeb394"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326">notify_all</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Notify all threads that are waiting for the condition. <a href="#ad35a04e61229c15c5211ebff00089326"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Condition variable class. </p>
<p>This is a signalling object for synchronizing the execution flow for several threads. Example usage: </p>
<div class="fragment"><pre class="fragment"> <span class="comment">// Shared data and associated mutex and condition variable objects</span>
<span class="keywordtype">int</span> count;
mutex m;
<a class="code" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9" title="Constructor.">condition_variable</a> cond;
<span class="comment">// Wait for the counter to reach a certain number</span>
<span class="keywordtype">void</span> wait_counter(<span class="keywordtype">int</span> targetCount)
{
lock_guard&lt;mutex&gt; guard(m);
<span class="keywordflow">while</span>(count &lt; targetCount)
cond.wait(m);
}
<span class="comment">// Increment the counter, and notify waiting threads</span>
<span class="keywordtype">void</span> increment()
{
lock_guard&lt;mutex&gt; guard(m);
++ count;
cond.notify_all();
}
</pre></div> <hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ad35a04e61229c15c5211ebff00089326"></a><!-- doxytag: member="tthread::condition_variable::notify_all" ref="ad35a04e61229c15c5211ebff00089326" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void notify_all </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Notify all threads that are waiting for the condition. </p>
<p>All threads that are blocked waiting for this condition variable will be woken up. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>Only threads that started waiting prior to this call will be woken up. </dd></dl>
</div>
</div>
<a class="anchor" id="a84c2ec0dd971c593883198a323eeb394"></a><!-- doxytag: member="tthread::condition_variable::notify_one" ref="a84c2ec0dd971c593883198a323eeb394" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void notify_one </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Notify one thread that is waiting for the condition. </p>
<p>If at least one thread is blocked waiting for this condition variable, one will be woken up. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>Only threads that started waiting prior to this call will be woken up. </dd></dl>
</div>
</div>
<a class="anchor" id="a4d877d804385bde4aacf2156e86faede"></a><!-- doxytag: member="tthread::condition_variable::wait" ref="a4d877d804385bde4aacf2156e86faede" args="(_mutexT &amp;aMutex)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wait </td>
<td>(</td>
<td class="paramtype">_mutexT &amp;&nbsp;</td>
<td class="paramname"> <em>aMutex</em></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Wait for the condition. </p>
<p>The function will block the calling thread until the condition variable is woken by <code><a class="el" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394" title="Notify one thread that is waiting for the condition.">notify_one()</a></code>, <code><a class="el" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326" title="Notify all threads that are waiting for the condition.">notify_all()</a></code> or a spurious wake up. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>aMutex</em>&nbsp;</td><td>A mutex that will be unlocked when the wait operation starts, an locked again as soon as the wait operation is finished. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>fast_mutex Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8">fast_mutex</a>()</td><td><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1fast__mutex.html#aa81aed607133209dade63a226818224d">lock</a>()</td><td><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6">try_lock</a>()</td><td><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403">unlock</a>()</td><td><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1fast__mutex.html#a5eea296c19289a40d7b76df35ecf72a7">~fast_mutex</a>()</td><td><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td><td><code> [inline]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,129 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: fast_mutex Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a>
</div>
</div>
<div class="contents">
<h1>fast_mutex Class Reference</h1><!-- doxytag: class="tthread::fast_mutex" -->
<p>Fast mutex class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="fast__mutex_8h_source.html">fast_mutex.h</a>&gt;</code></p>
<p><a href="classtthread_1_1fast__mutex-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aed9ff6c4d30b4fe2775a15c6778d96f8"></a><!-- doxytag: member="tthread::fast_mutex::fast_mutex" ref="aed9ff6c4d30b4fe2775a15c6778d96f8" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8">fast_mutex</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5eea296c19289a40d7b76df35ecf72a7"></a><!-- doxytag: member="tthread::fast_mutex::~fast_mutex" ref="a5eea296c19289a40d7b76df35ecf72a7" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html#a5eea296c19289a40d7b76df35ecf72a7">~fast_mutex</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html#aa81aed607133209dade63a226818224d">lock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Lock the mutex. <a href="#aa81aed607133209dade63a226818224d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6">try_lock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Try to lock the mutex. <a href="#aa24a64f788f142df670c3abc809d32b6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403">unlock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unlock the mutex. <a href="#a9278be8203e1c42e2619179882ae4403"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Fast mutex class. </p>
<p>This is a mutual exclusion object for synchronizing access to shared memory areas for several threads. It is similar to the <a class="el" href="classtthread_1_1mutex.html" title="Mutex class.">tthread::mutex</a> class, but instead of using system level functions, it is implemented as an atomic spin lock with very low CPU overhead.</p>
<p>The <code><a class="el" href="classtthread_1_1fast__mutex.html" title="Fast mutex class.">fast_mutex</a></code> class is NOT compatible with the <code><a class="el" href="classtthread_1_1condition__variable.html" title="Condition variable class.">condition_variable</a></code> class (however, it IS compatible with the <code><a class="el" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a></code> class). It should also be noted that the <code><a class="el" href="classtthread_1_1fast__mutex.html" title="Fast mutex class.">fast_mutex</a></code> class typically does not provide as accurate thread scheduling as a the standard <code>mutex</code> class does.</p>
<p>Because of the limitations of the class, it should only be used in situations where the mutex needs to be locked/unlocked very frequently.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>The "fast" version of this class relies on inline assembler language, which is currently only supported for 32/64-bit Intel x86/AMD64 and PowerPC architectures on a limited number of compilers (GNU g++ and MS Visual C++). For other architectures/compilers, system functions are used instead. </dd></dl>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aa81aed607133209dade63a226818224d"></a><!-- doxytag: member="tthread::fast_mutex::lock" ref="aa81aed607133209dade63a226818224d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Lock the mutex. </p>
<p>The method will block the calling thread until a lock on the mutex can be obtained. The mutex remains locked until <code><a class="el" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403" title="Unlock the mutex.">unlock()</a></code> is called. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a> </dd></dl>
</div>
</div>
<a class="anchor" id="aa24a64f788f142df670c3abc809d32b6"></a><!-- doxytag: member="tthread::fast_mutex::try_lock" ref="aa24a64f788f142df670c3abc809d32b6" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool try_lock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Try to lock the mutex. </p>
<p>The method will try to lock the mutex. If it fails, the function will return immediately (non-blocking). </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if the lock was acquired, or <code>false</code> if the lock could not be acquired. </dd></dl>
</div>
</div>
<a class="anchor" id="a9278be8203e1c42e2619179882ae4403"></a><!-- doxytag: member="tthread::fast_mutex::unlock" ref="a9278be8203e1c42e2619179882ae4403" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void unlock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Unlock the mutex. </p>
<p>If any threads are waiting for the lock on this mutex, one of them will be unblocked. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="fast__mutex_8h_source.html">fast_mutex.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>lock_guard&lt; T &gt; Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1lock__guard.html">lock_guard&lt; T &gt;</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1lock__guard.html#a2c5fd14427acb035def5201e4cfd4540">lock_guard</a>(mutex_type &amp;aMutex)</td><td><a class="el" href="classtthread_1_1lock__guard.html">lock_guard&lt; T &gt;</a></td><td><code> [inline, explicit]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1lock__guard.html#aa54999fb933a139807d39ed05e97aa6d">~lock_guard</a>()</td><td><a class="el" href="classtthread_1_1lock__guard.html">lock_guard&lt; T &gt;</a></td><td><code> [inline]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: lock_guard&lt; T &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1lock__guard.html">lock_guard</a>
</div>
</div>
<div class="contents">
<h1>lock_guard&lt; T &gt; Class Template Reference</h1><!-- doxytag: class="tthread::lock_guard" -->
<p>Lock guard class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1lock__guard-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2c5fd14427acb035def5201e4cfd4540"></a><!-- doxytag: member="tthread::lock_guard::lock_guard" ref="a2c5fd14427acb035def5201e4cfd4540" args="(mutex_type &amp;aMutex)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1lock__guard.html#a2c5fd14427acb035def5201e4cfd4540">lock_guard</a> (mutex_type &amp;aMutex)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The constructor locks the mutex. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa54999fb933a139807d39ed05e97aa6d"></a><!-- doxytag: member="tthread::lock_guard::~lock_guard" ref="aa54999fb933a139807d39ed05e97aa6d" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1lock__guard.html#aa54999fb933a139807d39ed05e97aa6d">~lock_guard</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The destructor unlocks the mutex. <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class T&gt;<br/>
class tthread::lock_guard&lt; T &gt;</h3>
<p>Lock guard class. </p>
<p>The constructor locks the mutex, and the destructor unlocks the mutex, so the mutex will automatically be unlocked when the lock guard goes out of scope. Example usage: </p>
<div class="fragment"><pre class="fragment"> mutex m;
<span class="keywordtype">int</span> counter;
<span class="keywordtype">void</span> increment()
{
lock_guard&lt;mutex&gt; guard(m);
++ counter;
}
</pre></div> <hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>mutex Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1mutex.html">mutex</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d">lock</a>()</td><td><a class="el" href="classtthread_1_1mutex.html">mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1mutex.html#aef42e2bd0ea2ffa8ce1cdc7e5d183910">mutex</a>()</td><td><a class="el" href="classtthread_1_1mutex.html">mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1mutex.html#aa24a64f788f142df670c3abc809d32b6">try_lock</a>()</td><td><a class="el" href="classtthread_1_1mutex.html">mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403">unlock</a>()</td><td><a class="el" href="classtthread_1_1mutex.html">mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1mutex.html#a3ab9328c3addeb57045f45910b10a1cf">~mutex</a>()</td><td><a class="el" href="classtthread_1_1mutex.html">mutex</a></td><td><code> [inline]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,127 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: mutex Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1mutex.html">mutex</a>
</div>
</div>
<div class="contents">
<h1>mutex Class Reference</h1><!-- doxytag: class="tthread::mutex" -->
<p>Mutex class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1mutex-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aef42e2bd0ea2ffa8ce1cdc7e5d183910"></a><!-- doxytag: member="tthread::mutex::mutex" ref="aef42e2bd0ea2ffa8ce1cdc7e5d183910" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html#aef42e2bd0ea2ffa8ce1cdc7e5d183910">mutex</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3ab9328c3addeb57045f45910b10a1cf"></a><!-- doxytag: member="tthread::mutex::~mutex" ref="a3ab9328c3addeb57045f45910b10a1cf" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html#a3ab9328c3addeb57045f45910b10a1cf">~mutex</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d">lock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Lock the mutex. <a href="#aa81aed607133209dade63a226818224d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html#aa24a64f788f142df670c3abc809d32b6">try_lock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Try to lock the mutex. <a href="#aa24a64f788f142df670c3abc809d32b6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403">unlock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unlock the mutex. <a href="#a9278be8203e1c42e2619179882ae4403"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Mutex class. </p>
<p>This is a mutual exclusion object for synchronizing access to shared memory areas for several threads. The mutex is non-recursive (i.e. a program may deadlock if the thread that owns a mutex object calls <a class="el" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d" title="Lock the mutex.">lock()</a> on that object). </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classtthread_1_1recursive__mutex.html" title="Recursive mutex class.">recursive_mutex</a> </dd></dl>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aa81aed607133209dade63a226818224d"></a><!-- doxytag: member="tthread::mutex::lock" ref="aa81aed607133209dade63a226818224d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Lock the mutex. </p>
<p>The method will block the calling thread until a lock on the mutex can be obtained. The mutex remains locked until <code><a class="el" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403" title="Unlock the mutex.">unlock()</a></code> is called. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a> </dd></dl>
</div>
</div>
<a class="anchor" id="aa24a64f788f142df670c3abc809d32b6"></a><!-- doxytag: member="tthread::mutex::try_lock" ref="aa24a64f788f142df670c3abc809d32b6" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool try_lock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Try to lock the mutex. </p>
<p>The method will try to lock the mutex. If it fails, the function will return immediately (non-blocking). </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if the lock was acquired, or <code>false</code> if the lock could not be acquired. </dd></dl>
</div>
</div>
<a class="anchor" id="a9278be8203e1c42e2619179882ae4403"></a><!-- doxytag: member="tthread::mutex::unlock" ref="a9278be8203e1c42e2619179882ae4403" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void unlock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Unlock the mutex. </p>
<p>If any threads are waiting for the lock on this mutex, one of them will be unblocked. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>ratio&lt; N, D &gt; Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1ratio.html">ratio&lt; N, D &gt;</a>, including all inherited members.<table>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: ratio&lt; N, D &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1ratio.html">ratio</a>
</div>
</div>
<div class="contents">
<h1>ratio&lt; N, D &gt; Class Template Reference</h1><!-- doxytag: class="tthread::ratio" -->
<p>Minimal implementation of the <code>ratio</code> class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1ratio-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;__intmax_t N, __intmax_t D = 1&gt;<br/>
class tthread::ratio&lt; N, D &gt;</h3>
<p>Minimal implementation of the <code>ratio</code> class. </p>
<p>This class provides enough functionality to implement some basic <code>chrono</code> classes. </p>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>recursive_mutex Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1recursive__mutex.html#aa81aed607133209dade63a226818224d">lock</a>()</td><td><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1recursive__mutex.html#a612d33a8905a3de216a8be0467538ede">recursive_mutex</a>()</td><td><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1recursive__mutex.html#aa24a64f788f142df670c3abc809d32b6">try_lock</a>()</td><td><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403">unlock</a>()</td><td><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1recursive__mutex.html#a571b16a7b52c4d1fb0bdb5ff0482c100">~recursive_mutex</a>()</td><td><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td><td><code> [inline]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,127 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: recursive_mutex Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a>
</div>
</div>
<div class="contents">
<h1>recursive_mutex Class Reference</h1><!-- doxytag: class="tthread::recursive_mutex" -->
<p>Recursive mutex class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1recursive__mutex-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a612d33a8905a3de216a8be0467538ede"></a><!-- doxytag: member="tthread::recursive_mutex::recursive_mutex" ref="a612d33a8905a3de216a8be0467538ede" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html#a612d33a8905a3de216a8be0467538ede">recursive_mutex</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a571b16a7b52c4d1fb0bdb5ff0482c100"></a><!-- doxytag: member="tthread::recursive_mutex::~recursive_mutex" ref="a571b16a7b52c4d1fb0bdb5ff0482c100" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html#a571b16a7b52c4d1fb0bdb5ff0482c100">~recursive_mutex</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html#aa81aed607133209dade63a226818224d">lock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Lock the mutex. <a href="#aa81aed607133209dade63a226818224d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html#aa24a64f788f142df670c3abc809d32b6">try_lock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Try to lock the mutex. <a href="#aa24a64f788f142df670c3abc809d32b6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403">unlock</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unlock the mutex. <a href="#a9278be8203e1c42e2619179882ae4403"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Recursive mutex class. </p>
<p>This is a mutual exclusion object for synchronizing access to shared memory areas for several threads. The mutex is recursive (i.e. a thread may lock the mutex several times, as long as it unlocks the mutex the same number of times). </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classtthread_1_1mutex.html" title="Mutex class.">mutex</a> </dd></dl>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aa81aed607133209dade63a226818224d"></a><!-- doxytag: member="tthread::recursive_mutex::lock" ref="aa81aed607133209dade63a226818224d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Lock the mutex. </p>
<p>The method will block the calling thread until a lock on the mutex can be obtained. The mutex remains locked until <code><a class="el" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403" title="Unlock the mutex.">unlock()</a></code> is called. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a> </dd></dl>
</div>
</div>
<a class="anchor" id="aa24a64f788f142df670c3abc809d32b6"></a><!-- doxytag: member="tthread::recursive_mutex::try_lock" ref="aa24a64f788f142df670c3abc809d32b6" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool try_lock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Try to lock the mutex. </p>
<p>The method will try to lock the mutex. If it fails, the function will return immediately (non-blocking). </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if the lock was acquired, or <code>false</code> if the lock could not be acquired. </dd></dl>
</div>
</div>
<a class="anchor" id="a9278be8203e1c42e2619179882ae4403"></a><!-- doxytag: member="tthread::recursive_mutex::unlock" ref="a9278be8203e1c42e2619179882ae4403" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void unlock </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Unlock the mutex. </p>
<p>If any threads are waiting for the lock on this mutex, one of them will be unblocked. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,42 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>thread Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1thread.html">thread</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#afb4f4110b330d27774c16baec4f7d4f5">get_id</a>() const </td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#a3b04fb20012111681e37dfe63f105f6d">hardware_concurrency</a>()</td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#a6c7abfff648dad193674fc432ad4840d">join</a>()</td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#a5f02386ef3b6ef614321b6ec3606b242">joinable</a>() const </td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#ac9ba019ced75a29c52c41aff4e1ca20e">native_handle</a>()</td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1">thread</a>()</td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#ad8d7d1e1d70de55c08472077b2e1a953">thread</a>(void(*aFunction)(void *), void *aArg)</td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread.html#a626c04c85c7e2b10215bc4a35062f177">~thread</a>()</td><td><a class="el" href="classtthread_1_1thread.html">thread</a></td><td></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,214 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: thread Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1thread.html">thread</a>
</div>
</div>
<div class="contents">
<h1>thread Class Reference</h1><!-- doxytag: class="tthread::thread" -->
<p>Thread class.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1thread-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread_1_1id.html">id</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Thread ID. <a href="classtthread_1_1thread_1_1id.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1">thread</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <a href="#a1816c2a63c2941090f9a24e5a62efea1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#ad8d7d1e1d70de55c08472077b2e1a953">thread</a> (void(*aFunction)(void *), void *aArg)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Thread starting constructor. <a href="#ad8d7d1e1d70de55c08472077b2e1a953"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#a626c04c85c7e2b10215bc4a35062f177">~thread</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <a href="#a626c04c85c7e2b10215bc4a35062f177"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6c7abfff648dad193674fc432ad4840d"></a><!-- doxytag: member="tthread::thread::join" ref="a6c7abfff648dad193674fc432ad4840d" args="()" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#a6c7abfff648dad193674fc432ad4840d">join</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wait for the thread to finish (join execution flows). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#a5f02386ef3b6ef614321b6ec3606b242">joinable</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if the thread is joinable. <a href="#a5f02386ef3b6ef614321b6ec3606b242"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afb4f4110b330d27774c16baec4f7d4f5"></a><!-- doxytag: member="tthread::thread::get_id" ref="afb4f4110b330d27774c16baec4f7d4f5" args="() const " -->
<a class="el" href="classtthread_1_1thread_1_1id.html">id</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#afb4f4110b330d27774c16baec4f7d4f5">get_id</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the thread ID of a thread object. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">native_handle_type&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#ac9ba019ced75a29c52c41aff4e1ca20e">native_handle</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the native handle for this thread. <a href="#ac9ba019ced75a29c52c41aff4e1ca20e"></a><br/></td></tr>
<tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static unsigned&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html#a3b04fb20012111681e37dfe63f105f6d">hardware_concurrency</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Determine the number of threads which can possibly execute concurrently. <a href="#a3b04fb20012111681e37dfe63f105f6d"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Thread class. </p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a1816c2a63c2941090f9a24e5a62efea1"></a><!-- doxytag: member="tthread::thread::thread" ref="a1816c2a63c2941090f9a24e5a62efea1" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classtthread_1_1thread.html">thread</a> </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor. </p>
<p>Construct a <code>thread</code> object without an associated thread of execution (i.e. non-joinable). </p>
</div>
</div>
<a class="anchor" id="ad8d7d1e1d70de55c08472077b2e1a953"></a><!-- doxytag: member="tthread::thread::thread" ref="ad8d7d1e1d70de55c08472077b2e1a953" args="(void(*aFunction)(void *), void *aArg)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classtthread_1_1thread.html">thread</a> </td>
<td>(</td>
<td class="paramtype">void(*)(void *)&nbsp;</td>
<td class="paramname"> <em>aFunction</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>aArg</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Thread starting constructor. </p>
<p>Construct a <code>thread</code> object with a new thread of execution. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>aFunction</em>&nbsp;</td><td>A function pointer to a function of type: <code>void fun(void * arg)</code> </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>aArg</em>&nbsp;</td><td>Argument to the thread function. </td></tr>
</table>
</dd>
</dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This constructor is not fully compatible with the standard C++ thread class. It is more similar to the pthread_create() (POSIX) and CreateThread() (Windows) functions. </dd></dl>
</div>
</div>
<a class="anchor" id="a626c04c85c7e2b10215bc4a35062f177"></a><!-- doxytag: member="tthread::thread::~thread" ref="a626c04c85c7e2b10215bc4a35062f177" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">~<a class="el" href="classtthread_1_1thread.html">thread</a> </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Destructor. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>If the thread is joinable upon destruction, <code>std::terminate()</code> will be called, which terminates the process. It is always wise to do <code><a class="el" href="classtthread_1_1thread.html#a6c7abfff648dad193674fc432ad4840d" title="Wait for the thread to finish (join execution flows).">join()</a></code> before deleting a thread object. </dd></dl>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a3b04fb20012111681e37dfe63f105f6d"></a><!-- doxytag: member="tthread::thread::hardware_concurrency" ref="a3b04fb20012111681e37dfe63f105f6d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static unsigned hardware_concurrency </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Determine the number of threads which can possibly execute concurrently. </p>
<p>This function is useful for determining the optimal number of threads to use for a task. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of hardware thread contexts in the system. </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>If this value is not defined, the function returns zero (0). </dd></dl>
</div>
</div>
<a class="anchor" id="a5f02386ef3b6ef614321b6ec3606b242"></a><!-- doxytag: member="tthread::thread::joinable" ref="a5f02386ef3b6ef614321b6ec3606b242" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool joinable </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Check if the thread is joinable. </p>
<p>A thread object is joinable if it has an associated thread of execution. </p>
</div>
</div>
<a class="anchor" id="ac9ba019ced75a29c52c41aff4e1ca20e"></a><!-- doxytag: member="tthread::thread::native_handle" ref="ac9ba019ced75a29c52c41aff4e1ca20e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">native_handle_type native_handle </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the native handle for this thread. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>Under Windows, this is a <code>HANDLE</code>, and under POSIX systems, this is a <code>pthread_t</code>. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>id Member List</h1>This is the complete list of members for <a class="el" href="classtthread_1_1thread_1_1id.html">id</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d">id</a>()</td><td><a class="el" href="classtthread_1_1thread_1_1id.html">id</a></td><td><code> [inline]</code></td></tr>
</table></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,75 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: id Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="classtthread_1_1thread.html">thread</a>::<a class="el" href="classtthread_1_1thread_1_1id.html">id</a>
</div>
</div>
<div class="contents">
<h1>id Class Reference</h1><!-- doxytag: class="tthread::thread::id" -->
<p>Thread ID.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tinythread_8h_source.html">tinythread.h</a>&gt;</code></p>
<p><a href="classtthread_1_1thread_1_1id-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d">id</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <a href="#a087060b582403885d08e89ad894ecc5d"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Thread ID. </p>
<p>The thread ID is a unique identifier for each thread. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classtthread_1_1thread.html#afb4f4110b330d27774c16baec4f7d4f5" title="Return the thread ID of a thread object.">thread::get_id()</a> </dd></dl>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a087060b582403885d08e89ad894ecc5d"></a><!-- doxytag: member="tthread::thread::id::id" ref="a087060b582403885d08e89ad894ecc5d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classtthread_1_1thread_1_1id.html">id</a> </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor. </p>
<p>The default constructed ID is that of thread without a thread of execution. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinythread_8h_source.html">tinythread.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

545
external/TinyThread/doc/html/doxygen.css vendored Normal file
View file

@ -0,0 +1,545 @@
/* The standard CSS for doxygen */
body, table, div, p, dl {
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
font-size: 12px;
}
/* @group Heading Levels */
h1 {
text-align: center;
font-size: 150%;
}
h2 {
font-size: 120%;
}
h3 {
font-size: 100%;
}
dt {
font-weight: bold;
}
div.multicol {
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
-moz-column-count: 3;
-webkit-column-count: 3;
}
p.startli, p.startdd, p.starttd {
margin-top: 2px;
}
p.endli {
margin-bottom: 0px;
}
p.enddd {
margin-bottom: 4px;
}
p.endtd {
margin-bottom: 2px;
}
/* @end */
caption {
font-weight: bold;
}
span.legend {
font-size: 70%;
text-align: center;
}
h3.version {
font-size: 90%;
text-align: center;
}
div.qindex, div.navtab{
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
}
div.qindex, div.navpath {
width: 100%;
line-height: 140%;
}
div.navtab {
margin-right: 15px;
}
/* @group Link Styling */
a {
color: #153788;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #1b77c5;
}
a:hover {
text-decoration: underline;
}
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.el {
font-weight: bold;
}
a.elRef {
}
a.code {
color: #3030f0;
}
a.codeRef {
color: #3030f0;
}
/* @end */
dl.el {
margin-left: -1cm;
}
.fragment {
font-family: monospace, fixed;
font-size: 105%;
}
pre.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
body {
background: white;
color: black;
margin-right: 20px;
margin-left: 20px;
}
td.indexkey {
background-color: #e8eef2;
font-weight: bold;
border: 1px solid #CCCCCC;
margin: 2px 0px 2px 0;
padding: 2px 10px;
}
td.indexvalue {
background-color: #e8eef2;
border: 1px solid #CCCCCC;
padding: 2px 10px;
margin: 2px 0px;
}
tr.memlist {
background-color: #f0f0f0;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
img.footer {
border: 0px;
vertical-align: middle;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
/* @end */
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
td.tiny {
font-size: 75%;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #84b0c7;
}
th.dirtab {
background: #e8eef2;
font-weight: bold;
}
hr {
height: 0px;
border: none;
border-top: 1px solid #666;
}
hr.footer {
height: 1px;
}
/* @group Member Descriptions */
.mdescLeft, .mdescRight,
.memItemLeft, .memItemRight,
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
background-color: #FAFAFA;
border: none;
margin: 4px;
padding: 1px 0 0 8px;
}
.mdescLeft, .mdescRight {
padding: 0px 8px 4px 8px;
color: #555;
}
.memItemLeft, .memItemRight, .memTemplParams {
border-top: 1px solid #ccc;
}
.memItemLeft, .memTemplItemLeft {
white-space: nowrap;
}
.memTemplParams {
color: #606060;
white-space: nowrap;
}
/* @end */
/* @group Member Details */
/* Styles for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #606060;
font-weight: normal;
margin-left: 3px;
}
.memnav {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.memitem {
padding: 0;
margin-bottom: 10px;
}
.memname {
white-space: nowrap;
font-weight: bold;
margin-left: 6px;
}
.memproto {
border-top: 1px solid #84b0c7;
border-left: 1px solid #84b0c7;
border-right: 1px solid #84b0c7;
padding: 0;
background-color: #d5e1e8;
font-weight: bold;
/* firefox specific markup */
background-image: -moz-linear-gradient(rgba(228, 233, 245, 1.0) 0%, rgba(193, 205, 232, 1.0) 100%);
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
-moz-border-radius-topright: 8px;
-moz-border-radius-topleft: 8px;
/* webkit specific markup */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(228, 233, 245, 1.0)), to(rgba(193, 205, 232, 1.0)));
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-webkit-border-top-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
}
.memdoc {
border-bottom: 1px solid #84b0c7;
border-left: 1px solid #84b0c7;
border-right: 1px solid #84b0c7;
padding: 2px 5px;
background-color: #eef3f5;
border-top-width: 0;
/* firefox specific markup */
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
/* webkit specific markup */
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
white-space: nowrap;
}
.paramname em {
font-style: normal;
}
/* @end */
/* @group Directory (tree) */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin: 0.5em;
}
/* these are for tree view when used as main index */
.directory {
font-size: 9pt;
font-weight: bold;
}
.directory h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
/*
The following two styles can be used to replace the root node title
with an image of your choice. Simply uncomment the next two styles,
specify the name of your image and be sure to set 'height' to the
proper pixel height of your image.
*/
/*
.directory h3.swap {
height: 61px;
background-repeat: no-repeat;
background-image: url("yourimage.gif");
}
.directory h3.swap span {
display: none;
}
*/
.directory > h3 {
margin-top: 0;
}
.directory p {
margin: 0px;
white-space: nowrap;
}
.directory div {
display: none;
margin: 0px;
}
.directory img {
vertical-align: -30%;
}
/* these are for tree view when not used as main index */
.directory-alt {
font-size: 100%;
font-weight: bold;
}
.directory-alt h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
.directory-alt > h3 {
margin-top: 0;
}
.directory-alt p {
margin: 0px;
white-space: nowrap;
}
.directory-alt div {
display: none;
margin: 0px;
}
.directory-alt img {
vertical-align: -30%;
}
/* @end */
address {
font-style: normal;
color: #333;
}
table.doxtable {
border-collapse:collapse;
}
table.doxtable td, table.doxtable th {
border: 1px solid #153788;
padding: 3px 7px 2px;
}
table.doxtable th {
background-color: #254798;
color: #FFFFFF;
font-size: 110%;
padding-bottom: 4px;
padding-top: 5px;
text-align:left;
}

BIN
external/TinyThread/doc/html/doxygen.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,48 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: fast_mutex.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>fast_mutex.h File Reference</h1><code>#include &lt;pthread.h&gt;</code><br/>
<p><a href="fast__mutex_8h_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Fast mutex class. <a href="classtthread_1_1fast__mutex.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Namespaces</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread.html">tthread</a></td></tr>
<p><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p>Main name space for TinyThread++. </p>
<br/></td></tr>
</p>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,237 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: fast_mutex.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<h1>fast_mutex.h</h1><a href="fast__mutex_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">Copyright (c) 2010 Marcus Geelnard</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span>
<a name="l00005"></a>00005 <span class="comment">warranty. In no event will the authors be held liable for any damages</span>
<a name="l00006"></a>00006 <span class="comment">arising from the use of this software.</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00009"></a>00009 <span class="comment">including commercial applications, and to alter it and redistribute it</span>
<a name="l00010"></a>00010 <span class="comment">freely, subject to the following restrictions:</span>
<a name="l00011"></a>00011 <span class="comment"></span>
<a name="l00012"></a>00012 <span class="comment"> 1. The origin of this software must not be misrepresented; you must not</span>
<a name="l00013"></a>00013 <span class="comment"> claim that you wrote the original software. If you use this software</span>
<a name="l00014"></a>00014 <span class="comment"> in a product, an acknowledgment in the product documentation would be</span>
<a name="l00015"></a>00015 <span class="comment"> appreciated but is not required.</span>
<a name="l00016"></a>00016 <span class="comment"></span>
<a name="l00017"></a>00017 <span class="comment"> 2. Altered source versions must be plainly marked as such, and must not be</span>
<a name="l00018"></a>00018 <span class="comment"> misrepresented as being the original software.</span>
<a name="l00019"></a>00019 <span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment"> 3. This notice may not be removed or altered from any source</span>
<a name="l00021"></a>00021 <span class="comment"> distribution.</span>
<a name="l00022"></a>00022 <span class="comment">*/</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef _FAST_MUTEX_H_</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define _FAST_MUTEX_H_</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00028"></a>00028
<a name="l00029"></a>00029 <span class="comment">// Which platform are we on?</span>
<a name="l00030"></a>00030 <span class="preprocessor">#if !defined(_TTHREAD_PLATFORM_DEFINED_)</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor"> #if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__)</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_WIN32_</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor"> #else</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_POSIX_</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_PLATFORM_DEFINED_</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="comment">// Check if we can support the assembly language level implementation (otherwise</span>
<a name="l00040"></a>00040 <span class="comment">// revert to the system API)</span>
<a name="l00041"></a>00041 <span class="preprocessor">#if (defined(__GNUC__) &amp;&amp; (defined(__i386__) || defined(__x86_64__))) || \</span>
<a name="l00042"></a>00042 <span class="preprocessor"> (defined(_MSC_VER) &amp;&amp; (defined(_M_IX86) || defined(_M_X64))) || \</span>
<a name="l00043"></a>00043 <span class="preprocessor"> (defined(__GNUC__) &amp;&amp; (defined(__ppc__)))</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor"> #define _FAST_MUTEX_ASM_</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor"> #define _FAST_MUTEX_SYS_</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00049"></a>00049 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor"> #include &lt;windows.h&gt;</span>
<a name="l00051"></a>00051 <span class="preprocessor">#else</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor"> #ifdef _FAST_MUTEX_ASM_</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor"> #include &lt;sched.h&gt;</span>
<a name="l00054"></a>00054 <span class="preprocessor"> #else</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor"> #include &lt;pthread.h&gt;</span>
<a name="l00056"></a>00056 <span class="preprocessor"> #endif</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span>
<a name="l00059"></a><a class="code" href="namespacetthread.html">00059</a> <span class="keyword">namespace </span>tthread {
<a name="l00060"></a>00060
<a name="l00080"></a><a class="code" href="classtthread_1_1fast__mutex.html">00080</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1fast__mutex.html" title="Fast mutex class.">fast_mutex</a> {
<a name="l00081"></a>00081 <span class="keyword">public</span>:
<a name="l00083"></a>00083 <span class="preprocessor">#if defined(_FAST_MUTEX_ASM_)</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span> <a class="code" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8" title="Constructor.">fast_mutex</a>() : mLock(0) {}
<a name="l00085"></a>00085 <span class="preprocessor">#else</span>
<a name="l00086"></a><a class="code" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8">00086</a> <span class="preprocessor"></span> <a class="code" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8" title="Constructor.">fast_mutex</a>()
<a name="l00087"></a>00087 {
<a name="l00088"></a>00088 <span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span> InitializeCriticalSection(&amp;mHandle);
<a name="l00090"></a>00090 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span> pthread_mutex_init(&amp;mHandle, NULL);
<a name="l00092"></a>00092 <span class="preprocessor"> #endif</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span> }
<a name="l00094"></a>00094 <span class="preprocessor">#endif</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span>
<a name="l00096"></a>00096 <span class="preprocessor">#if !defined(_FAST_MUTEX_ASM_)</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span>
<a name="l00098"></a><a class="code" href="classtthread_1_1fast__mutex.html#a5eea296c19289a40d7b76df35ecf72a7">00098</a> <a class="code" href="classtthread_1_1fast__mutex.html#a5eea296c19289a40d7b76df35ecf72a7" title="Destructor.">~fast_mutex</a>()
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100 <span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span> DeleteCriticalSection(&amp;mHandle);
<a name="l00102"></a>00102 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span> pthread_mutex_destroy(&amp;mHandle);
<a name="l00104"></a>00104 <span class="preprocessor"> #endif</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span> }
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
<a name="l00107"></a>00107 <span class="preprocessor"></span>
<a name="l00112"></a><a class="code" href="classtthread_1_1fast__mutex.html#aa81aed607133209dade63a226818224d">00112</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1fast__mutex.html#aa81aed607133209dade63a226818224d" title="Lock the mutex.">lock</a>()
<a name="l00113"></a>00113 {
<a name="l00114"></a>00114 <span class="preprocessor">#if defined(_FAST_MUTEX_ASM_)</span>
<a name="l00115"></a>00115 <span class="preprocessor"></span> <span class="keywordtype">bool</span> gotLock;
<a name="l00116"></a>00116 <span class="keywordflow">do</span> {
<a name="l00117"></a>00117 gotLock = <a class="code" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6" title="Try to lock the mutex.">try_lock</a>();
<a name="l00118"></a>00118 <span class="keywordflow">if</span>(!gotLock)
<a name="l00119"></a>00119 {
<a name="l00120"></a>00120 <span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00121"></a>00121 <span class="preprocessor"></span> Sleep(0);
<a name="l00122"></a>00122 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span> sched_yield();
<a name="l00124"></a>00124 <span class="preprocessor"> #endif</span>
<a name="l00125"></a>00125 <span class="preprocessor"></span> }
<a name="l00126"></a>00126 } <span class="keywordflow">while</span>(!gotLock);
<a name="l00127"></a>00127 <span class="preprocessor">#else</span>
<a name="l00128"></a>00128 <span class="preprocessor"></span><span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00129"></a>00129 <span class="preprocessor"></span> EnterCriticalSection(&amp;mHandle);
<a name="l00130"></a>00130 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span> pthread_mutex_lock(&amp;mHandle);
<a name="l00132"></a>00132 <span class="preprocessor"> #endif</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00134"></a>00134 <span class="preprocessor"></span> }
<a name="l00135"></a>00135
<a name="l00141"></a><a class="code" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6">00141</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6" title="Try to lock the mutex.">try_lock</a>()
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143 <span class="preprocessor">#if defined(_FAST_MUTEX_ASM_)</span>
<a name="l00144"></a>00144 <span class="preprocessor"></span> <span class="keywordtype">int</span> oldLock;
<a name="l00145"></a>00145 <span class="preprocessor"> #if defined(__GNUC__) &amp;&amp; (defined(__i386__) || defined(__x86_64__))</span>
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> (
<a name="l00147"></a>00147 <span class="stringliteral">&quot;movl $1,%%eax\n\t&quot;</span>
<a name="l00148"></a>00148 <span class="stringliteral">&quot;xchg %%eax,%0\n\t&quot;</span>
<a name="l00149"></a>00149 <span class="stringliteral">&quot;movl %%eax,%1\n\t&quot;</span>
<a name="l00150"></a>00150 : <span class="stringliteral">&quot;=m&quot;</span> (mLock), <span class="stringliteral">&quot;=m&quot;</span> (oldLock)
<a name="l00151"></a>00151 :
<a name="l00152"></a>00152 : <span class="stringliteral">&quot;%eax&quot;</span>, <span class="stringliteral">&quot;memory&quot;</span>
<a name="l00153"></a>00153 );
<a name="l00154"></a>00154 <span class="preprocessor"> #elif defined(_MSC_VER) &amp;&amp; (defined(_M_IX86) || defined(_M_X64))</span>
<a name="l00155"></a>00155 <span class="preprocessor"></span> <span class="keywordtype">int</span> *ptrLock = &amp;mLock;
<a name="l00156"></a>00156 __asm {
<a name="l00157"></a>00157 mov eax,1
<a name="l00158"></a>00158 mov ecx,ptrLock
<a name="l00159"></a>00159 xchg eax,[ecx]
<a name="l00160"></a>00160 mov oldLock,eax
<a name="l00161"></a>00161 }
<a name="l00162"></a>00162 <span class="preprocessor"> #elif defined(__GNUC__) &amp;&amp; (defined(__ppc__))</span>
<a name="l00163"></a>00163 <span class="preprocessor"></span> <span class="keywordtype">int</span> newLock = 1;
<a name="l00164"></a>00164 <span class="keyword">asm</span> <span class="keyword">volatile</span> (
<a name="l00165"></a>00165 <span class="stringliteral">&quot;\n1:\n\t&quot;</span>
<a name="l00166"></a>00166 <span class="stringliteral">&quot;lwarx %0,0,%1\n\t&quot;</span>
<a name="l00167"></a>00167 <span class="stringliteral">&quot;cmpwi 0,%0,0\n\t&quot;</span>
<a name="l00168"></a>00168 <span class="stringliteral">&quot;bne- 2f\n\t&quot;</span>
<a name="l00169"></a>00169 <span class="stringliteral">&quot;stwcx. %2,0,%1\n\t&quot;</span>
<a name="l00170"></a>00170 <span class="stringliteral">&quot;bne- 1b\n\t&quot;</span>
<a name="l00171"></a>00171 <span class="stringliteral">&quot;isync\n&quot;</span>
<a name="l00172"></a>00172 <span class="stringliteral">&quot;2:\n\t&quot;</span>
<a name="l00173"></a>00173 : <span class="stringliteral">&quot;=&amp;r&quot;</span> (oldLock)
<a name="l00174"></a>00174 : <span class="stringliteral">&quot;r&quot;</span> (&amp;mLock), <span class="stringliteral">&quot;r&quot;</span> (newLock)
<a name="l00175"></a>00175 : <span class="stringliteral">&quot;cr0&quot;</span>, <span class="stringliteral">&quot;memory&quot;</span>
<a name="l00176"></a>00176 );
<a name="l00177"></a>00177 <span class="preprocessor"> #endif</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span> <span class="keywordflow">return</span> (oldLock == 0);
<a name="l00179"></a>00179 <span class="preprocessor">#else</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span><span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00181"></a>00181 <span class="preprocessor"></span> <span class="keywordflow">return</span> TryEnterCriticalSection(&amp;mHandle) ? <span class="keyword">true</span> : <span class="keyword">false</span>;
<a name="l00182"></a>00182 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00183"></a>00183 <span class="preprocessor"></span> <span class="keywordflow">return</span> (pthread_mutex_trylock(&amp;mHandle) == 0) ? <span class="keyword">true</span> : <span class="keyword">false</span>;
<a name="l00184"></a>00184 <span class="preprocessor"> #endif</span>
<a name="l00185"></a>00185 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span> }
<a name="l00187"></a>00187
<a name="l00191"></a><a class="code" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403">00191</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403" title="Unlock the mutex.">unlock</a>()
<a name="l00192"></a>00192 {
<a name="l00193"></a>00193 <span class="preprocessor">#if defined(_FAST_MUTEX_ASM_)</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span><span class="preprocessor"> #if defined(__GNUC__) &amp;&amp; (defined(__i386__) || defined(__x86_64__))</span>
<a name="l00195"></a>00195 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> (
<a name="l00196"></a>00196 <span class="stringliteral">&quot;movl $0,%%eax\n\t&quot;</span>
<a name="l00197"></a>00197 <span class="stringliteral">&quot;xchg %%eax,%0\n\t&quot;</span>
<a name="l00198"></a>00198 : <span class="stringliteral">&quot;=m&quot;</span> (mLock)
<a name="l00199"></a>00199 :
<a name="l00200"></a>00200 : <span class="stringliteral">&quot;%eax&quot;</span>, <span class="stringliteral">&quot;memory&quot;</span>
<a name="l00201"></a>00201 );
<a name="l00202"></a>00202 <span class="preprocessor"> #elif defined(_MSC_VER) &amp;&amp; (defined(_M_IX86) || defined(_M_X64))</span>
<a name="l00203"></a>00203 <span class="preprocessor"></span> <span class="keywordtype">int</span> *ptrLock = &amp;mLock;
<a name="l00204"></a>00204 __asm {
<a name="l00205"></a>00205 mov eax,0
<a name="l00206"></a>00206 mov ecx,ptrLock
<a name="l00207"></a>00207 xchg eax,[ecx]
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209 <span class="preprocessor"> #elif defined(__GNUC__) &amp;&amp; (defined(__ppc__))</span>
<a name="l00210"></a>00210 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> (
<a name="l00211"></a>00211 <span class="stringliteral">&quot;sync\n\t&quot;</span> <span class="comment">// Replace with lwsync where possible?</span>
<a name="l00212"></a>00212 : : : <span class="stringliteral">&quot;memory&quot;</span>
<a name="l00213"></a>00213 );
<a name="l00214"></a>00214 mLock = 0;
<a name="l00215"></a>00215 <span class="preprocessor"> #endif</span>
<a name="l00216"></a>00216 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00217"></a>00217 <span class="preprocessor"></span><span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00218"></a>00218 <span class="preprocessor"></span> LeaveCriticalSection(&amp;mHandle);
<a name="l00219"></a>00219 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00220"></a>00220 <span class="preprocessor"></span> pthread_mutex_unlock(&amp;mHandle);
<a name="l00221"></a>00221 <span class="preprocessor"> #endif</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00223"></a>00223 <span class="preprocessor"></span> }
<a name="l00224"></a>00224
<a name="l00225"></a>00225 <span class="keyword">private</span>:
<a name="l00226"></a>00226 <span class="preprocessor">#if defined(_FAST_MUTEX_ASM_)</span>
<a name="l00227"></a>00227 <span class="preprocessor"></span> <span class="keywordtype">int</span> mLock;
<a name="l00228"></a>00228 <span class="preprocessor">#else</span>
<a name="l00229"></a>00229 <span class="preprocessor"></span><span class="preprocessor"> #if defined(_TTHREAD_WIN32_)</span>
<a name="l00230"></a>00230 <span class="preprocessor"></span> CRITICAL_SECTION mHandle;
<a name="l00231"></a>00231 <span class="preprocessor"> #elif defined(_TTHREAD_POSIX_)</span>
<a name="l00232"></a>00232 <span class="preprocessor"></span> pthread_mutex_t mHandle;
<a name="l00233"></a>00233 <span class="preprocessor"> #endif</span>
<a name="l00234"></a>00234 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00235"></a>00235 <span class="preprocessor"></span>};
<a name="l00236"></a>00236
<a name="l00237"></a>00237 }
<a name="l00238"></a>00238
<a name="l00239"></a>00239 <span class="preprocessor">#endif // _FAST_MUTEX_H_</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

37
external/TinyThread/doc/html/files.html vendored Normal file
View file

@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: File Index</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>File List</h1>Here is a list of all documented files with brief descriptions:<table>
<tr><td class="indexkey"><a class="el" href="fast__mutex_8h.html">fast_mutex.h</a> <a href="fast__mutex_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="tinythread_8h.html">tinythread.h</a> <a href="tinythread_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
</table>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,202 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li class="current"><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_func.html"><span>Functions</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_f"><span>f</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_h"><span>h</span></a></li>
<li><a href="#index_i"><span>i</span></a></li>
<li><a href="#index_j"><span>j</span></a></li>
<li><a href="#index_l"><span>l</span></a></li>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_n"><span>n</span></a></li>
<li><a href="#index_r"><span>r</span></a></li>
<li><a href="#index_t"><span>t</span></a></li>
<li><a href="#index_u"><span>u</span></a></li>
<li><a href="#index_w"><span>w</span></a></li>
<li><a href="#index_~"><span>~</span></a></li>
</ul>
</div>
</div>
<div class="contents">
Here is a list of all documented class members with links to the class documentation for each member:
<h3><a class="anchor" id="index_c">- c -</a></h3><ul>
<li>condition_variable()
: <a class="el" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9">condition_variable</a>
</li>
<li>count()
: <a class="el" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020">duration&lt; _Rep, _Period &gt;</a>
</li>
</ul>
<h3><a class="anchor" id="index_d">- d -</a></h3><ul>
<li>duration()
: <a class="el" href="classtthread_1_1chrono_1_1duration.html#a5d86b0d68c98b74e3a6e541c1759ef3e">duration&lt; _Rep, _Period &gt;</a>
</li>
</ul>
<h3><a class="anchor" id="index_f">- f -</a></h3><ul>
<li>fast_mutex()
: <a class="el" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8">fast_mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_g">- g -</a></h3><ul>
<li>get_id()
: <a class="el" href="classtthread_1_1thread.html#afb4f4110b330d27774c16baec4f7d4f5">thread</a>
</li>
</ul>
<h3><a class="anchor" id="index_h">- h -</a></h3><ul>
<li>hardware_concurrency()
: <a class="el" href="classtthread_1_1thread.html#a3b04fb20012111681e37dfe63f105f6d">thread</a>
</li>
</ul>
<h3><a class="anchor" id="index_i">- i -</a></h3><ul>
<li>id()
: <a class="el" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d">id</a>
</li>
</ul>
<h3><a class="anchor" id="index_j">- j -</a></h3><ul>
<li>join()
: <a class="el" href="classtthread_1_1thread.html#a6c7abfff648dad193674fc432ad4840d">thread</a>
</li>
<li>joinable()
: <a class="el" href="classtthread_1_1thread.html#a5f02386ef3b6ef614321b6ec3606b242">thread</a>
</li>
</ul>
<h3><a class="anchor" id="index_l">- l -</a></h3><ul>
<li>lock()
: <a class="el" href="classtthread_1_1fast__mutex.html#aa81aed607133209dade63a226818224d">fast_mutex</a>
, <a class="el" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d">mutex</a>
, <a class="el" href="classtthread_1_1recursive__mutex.html#aa81aed607133209dade63a226818224d">recursive_mutex</a>
</li>
<li>lock_guard()
: <a class="el" href="classtthread_1_1lock__guard.html#a2c5fd14427acb035def5201e4cfd4540">lock_guard&lt; T &gt;</a>
</li>
</ul>
<h3><a class="anchor" id="index_m">- m -</a></h3><ul>
<li>mutex()
: <a class="el" href="classtthread_1_1mutex.html#aef42e2bd0ea2ffa8ce1cdc7e5d183910">mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_n">- n -</a></h3><ul>
<li>native_handle()
: <a class="el" href="classtthread_1_1thread.html#ac9ba019ced75a29c52c41aff4e1ca20e">thread</a>
</li>
<li>notify_all()
: <a class="el" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326">condition_variable</a>
</li>
<li>notify_one()
: <a class="el" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394">condition_variable</a>
</li>
</ul>
<h3><a class="anchor" id="index_r">- r -</a></h3><ul>
<li>recursive_mutex()
: <a class="el" href="classtthread_1_1recursive__mutex.html#a612d33a8905a3de216a8be0467538ede">recursive_mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_t">- t -</a></h3><ul>
<li>thread()
: <a class="el" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1">thread</a>
</li>
<li>try_lock()
: <a class="el" href="classtthread_1_1mutex.html#aa24a64f788f142df670c3abc809d32b6">mutex</a>
, <a class="el" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6">fast_mutex</a>
, <a class="el" href="classtthread_1_1recursive__mutex.html#aa24a64f788f142df670c3abc809d32b6">recursive_mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_u">- u -</a></h3><ul>
<li>unlock()
: <a class="el" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403">fast_mutex</a>
, <a class="el" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403">recursive_mutex</a>
, <a class="el" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403">mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_w">- w -</a></h3><ul>
<li>wait()
: <a class="el" href="classtthread_1_1condition__variable.html#a4d877d804385bde4aacf2156e86faede">condition_variable</a>
</li>
</ul>
<h3><a class="anchor" id="index_0x7e">- ~ -</a></h3><ul>
<li>~condition_variable()
: <a class="el" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b">condition_variable</a>
</li>
<li>~fast_mutex()
: <a class="el" href="classtthread_1_1fast__mutex.html#a5eea296c19289a40d7b76df35ecf72a7">fast_mutex</a>
</li>
<li>~lock_guard()
: <a class="el" href="classtthread_1_1lock__guard.html#aa54999fb933a139807d39ed05e97aa6d">lock_guard&lt; T &gt;</a>
</li>
<li>~mutex()
: <a class="el" href="classtthread_1_1mutex.html#a3ab9328c3addeb57045f45910b10a1cf">mutex</a>
</li>
<li>~recursive_mutex()
: <a class="el" href="classtthread_1_1recursive__mutex.html#a571b16a7b52c4d1fb0bdb5ff0482c100">recursive_mutex</a>
</li>
<li>~thread()
: <a class="el" href="classtthread_1_1thread.html#a626c04c85c7e2b10215bc4a35062f177">thread</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,202 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members - Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li class="current"><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="functions.html"><span>All</span></a></li>
<li class="current"><a href="functions_func.html"><span>Functions</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_f"><span>f</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_h"><span>h</span></a></li>
<li><a href="#index_i"><span>i</span></a></li>
<li><a href="#index_j"><span>j</span></a></li>
<li><a href="#index_l"><span>l</span></a></li>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_n"><span>n</span></a></li>
<li><a href="#index_r"><span>r</span></a></li>
<li><a href="#index_t"><span>t</span></a></li>
<li><a href="#index_u"><span>u</span></a></li>
<li><a href="#index_w"><span>w</span></a></li>
<li><a href="#index_~"><span>~</span></a></li>
</ul>
</div>
</div>
<div class="contents">
&nbsp;
<h3><a class="anchor" id="index_c">- c -</a></h3><ul>
<li>condition_variable()
: <a class="el" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9">condition_variable</a>
</li>
<li>count()
: <a class="el" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020">duration&lt; _Rep, _Period &gt;</a>
</li>
</ul>
<h3><a class="anchor" id="index_d">- d -</a></h3><ul>
<li>duration()
: <a class="el" href="classtthread_1_1chrono_1_1duration.html#a5d86b0d68c98b74e3a6e541c1759ef3e">duration&lt; _Rep, _Period &gt;</a>
</li>
</ul>
<h3><a class="anchor" id="index_f">- f -</a></h3><ul>
<li>fast_mutex()
: <a class="el" href="classtthread_1_1fast__mutex.html#aed9ff6c4d30b4fe2775a15c6778d96f8">fast_mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_g">- g -</a></h3><ul>
<li>get_id()
: <a class="el" href="classtthread_1_1thread.html#afb4f4110b330d27774c16baec4f7d4f5">thread</a>
</li>
</ul>
<h3><a class="anchor" id="index_h">- h -</a></h3><ul>
<li>hardware_concurrency()
: <a class="el" href="classtthread_1_1thread.html#a3b04fb20012111681e37dfe63f105f6d">thread</a>
</li>
</ul>
<h3><a class="anchor" id="index_i">- i -</a></h3><ul>
<li>id()
: <a class="el" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d">id</a>
</li>
</ul>
<h3><a class="anchor" id="index_j">- j -</a></h3><ul>
<li>join()
: <a class="el" href="classtthread_1_1thread.html#a6c7abfff648dad193674fc432ad4840d">thread</a>
</li>
<li>joinable()
: <a class="el" href="classtthread_1_1thread.html#a5f02386ef3b6ef614321b6ec3606b242">thread</a>
</li>
</ul>
<h3><a class="anchor" id="index_l">- l -</a></h3><ul>
<li>lock()
: <a class="el" href="classtthread_1_1fast__mutex.html#aa81aed607133209dade63a226818224d">fast_mutex</a>
, <a class="el" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d">mutex</a>
, <a class="el" href="classtthread_1_1recursive__mutex.html#aa81aed607133209dade63a226818224d">recursive_mutex</a>
</li>
<li>lock_guard()
: <a class="el" href="classtthread_1_1lock__guard.html#a2c5fd14427acb035def5201e4cfd4540">lock_guard&lt; T &gt;</a>
</li>
</ul>
<h3><a class="anchor" id="index_m">- m -</a></h3><ul>
<li>mutex()
: <a class="el" href="classtthread_1_1mutex.html#aef42e2bd0ea2ffa8ce1cdc7e5d183910">mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_n">- n -</a></h3><ul>
<li>native_handle()
: <a class="el" href="classtthread_1_1thread.html#ac9ba019ced75a29c52c41aff4e1ca20e">thread</a>
</li>
<li>notify_all()
: <a class="el" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326">condition_variable</a>
</li>
<li>notify_one()
: <a class="el" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394">condition_variable</a>
</li>
</ul>
<h3><a class="anchor" id="index_r">- r -</a></h3><ul>
<li>recursive_mutex()
: <a class="el" href="classtthread_1_1recursive__mutex.html#a612d33a8905a3de216a8be0467538ede">recursive_mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_t">- t -</a></h3><ul>
<li>thread()
: <a class="el" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1">thread</a>
</li>
<li>try_lock()
: <a class="el" href="classtthread_1_1mutex.html#aa24a64f788f142df670c3abc809d32b6">mutex</a>
, <a class="el" href="classtthread_1_1fast__mutex.html#aa24a64f788f142df670c3abc809d32b6">fast_mutex</a>
, <a class="el" href="classtthread_1_1recursive__mutex.html#aa24a64f788f142df670c3abc809d32b6">recursive_mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_u">- u -</a></h3><ul>
<li>unlock()
: <a class="el" href="classtthread_1_1fast__mutex.html#a9278be8203e1c42e2619179882ae4403">fast_mutex</a>
, <a class="el" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403">recursive_mutex</a>
, <a class="el" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403">mutex</a>
</li>
</ul>
<h3><a class="anchor" id="index_w">- w -</a></h3><ul>
<li>wait()
: <a class="el" href="classtthread_1_1condition__variable.html#a4d877d804385bde4aacf2156e86faede">condition_variable</a>
</li>
</ul>
<h3><a class="anchor" id="index_0x7e">- ~ -</a></h3><ul>
<li>~condition_variable()
: <a class="el" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b">condition_variable</a>
</li>
<li>~fast_mutex()
: <a class="el" href="classtthread_1_1fast__mutex.html#a5eea296c19289a40d7b76df35ecf72a7">fast_mutex</a>
</li>
<li>~lock_guard()
: <a class="el" href="classtthread_1_1lock__guard.html#aa54999fb933a139807d39ed05e97aa6d">lock_guard&lt; T &gt;</a>
</li>
<li>~mutex()
: <a class="el" href="classtthread_1_1mutex.html#a3ab9328c3addeb57045f45910b10a1cf">mutex</a>
</li>
<li>~recursive_mutex()
: <a class="el" href="classtthread_1_1recursive__mutex.html#a571b16a7b52c4d1fb0bdb5ff0482c100">recursive_mutex</a>
</li>
<li>~thread()
: <a class="el" href="classtthread_1_1thread.html#a626c04c85c7e2b10215bc4a35062f177">thread</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li class="current"><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
</div>
<div class="contents">
Here is a list of all documented file members with links to the documentation:<ul>
<li>thread_local
: <a class="el" href="tinythread_8h.html#ad4d9b405bcbffaf0d4dae6166c18aa1e">tinythread.h</a>
</li>
<li>TINYTHREAD_VERSION
: <a class="el" href="tinythread_8h.html#a9a3d5a9159f22201a37dd59d82b1861f">tinythread.h</a>
</li>
<li>TINYTHREAD_VERSION_MAJOR
: <a class="el" href="tinythread_8h.html#af1d2d7842598b143f8e0a54a9b6f5bec">tinythread.h</a>
</li>
<li>TINYTHREAD_VERSION_MINOR
: <a class="el" href="tinythread_8h.html#a9248a2e6daaeb43e46bd632417cb4733">tinythread.h</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li class="current"><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
</div>
<div class="contents">
&nbsp;<ul>
<li>thread_local
: <a class="el" href="tinythread_8h.html#ad4d9b405bcbffaf0d4dae6166c18aa1e">tinythread.h</a>
</li>
<li>TINYTHREAD_VERSION
: <a class="el" href="tinythread_8h.html#a9a3d5a9159f22201a37dd59d82b1861f">tinythread.h</a>
</li>
<li>TINYTHREAD_VERSION_MAJOR
: <a class="el" href="tinythread_8h.html#af1d2d7842598b143f8e0a54a9b6f5bec">tinythread.h</a>
</li>
<li>TINYTHREAD_VERSION_MINOR
: <a class="el" href="tinythread_8h.html#a9248a2e6daaeb43e46bd632417cb4733">tinythread.h</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

49
external/TinyThread/doc/html/index.html vendored Normal file
View file

@ -0,0 +1,49 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: TinyThread++ API Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li class="current"><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>TinyThread++ API Reference </h1><h3 class="version">1.0 </h3><h2><a class="anchor" id="intro_sec">
Introduction</a></h2>
<p>TinyThread++ is a minimal, portable implementation of basic threading classes for C++.</p>
<p>They closely mimic the functionality and naming of the C++0x standard, and should be easily replaceable with the corresponding std:: variants.</p>
<h2><a class="anchor" id="port_sec">
Portability</a></h2>
<p>The Win32 variant uses the native Win32 API for implementing the thread classes, while for other systems, the POSIX threads API (pthread) is used.</p>
<h2><a class="anchor" id="class_sec">
Classes</a></h2>
<p>In order to mimic the threading API of the C++0x standard, subsets of several classes are provided. The fundamental classes are: </p>
<ul>
<li><a class="el" href="classtthread_1_1thread.html" title="Thread class.">tthread::thread</a> </li>
<li><a class="el" href="classtthread_1_1mutex.html" title="Mutex class.">tthread::mutex</a> </li>
<li><a class="el" href="classtthread_1_1recursive__mutex.html" title="Recursive mutex class.">tthread::recursive_mutex</a> </li>
<li><a class="el" href="classtthread_1_1condition__variable.html" title="Condition variable class.">tthread::condition_variable</a> </li>
<li><a class="el" href="classtthread_1_1lock__guard.html" title="Lock guard class.">tthread::lock_guard</a> </li>
<li><a class="el" href="classtthread_1_1fast__mutex.html" title="Fast mutex class.">tthread::fast_mutex</a></li>
</ul>
<h2><a class="anchor" id="misc_sec">
Miscellaneous</a></h2>
<p>The following special keywords are available: <a class="el" href="tinythread_8h.html#ad4d9b405bcbffaf0d4dae6166c18aa1e" title="Thread local storage keyword.">thread_local</a>.</p>
<p>For more detailed information (including additional classes), browse the different sections of this documentation. A good place to start is: <a class="el" href="tinythread_8h.html">tinythread.h</a>. </p>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li class="current"><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="namespacemembers.html"><span>All</span></a></li>
<li><a href="namespacemembers_func.html"><span>Functions</span></a></li>
<li><a href="namespacemembers_type.html"><span>Typedefs</span></a></li>
</ul>
</div>
</div>
<div class="contents">
Here is a list of all documented namespace members with links to the namespaces they belong to:<ul>
<li>get_id()
: <a class="el" href="namespacetthread_1_1this__thread.html#ab9370620a3920b9ec550f84fb44fb032">tthread::this_thread</a>
</li>
<li>hours
: <a class="el" href="namespacetthread_1_1chrono.html#af212c337748be0da79f5a3a509f36cdf">tthread::chrono</a>
</li>
<li>microseconds
: <a class="el" href="namespacetthread_1_1chrono.html#add152055d7a764f3c1e5af1710f8814f">tthread::chrono</a>
</li>
<li>milliseconds
: <a class="el" href="namespacetthread_1_1chrono.html#a2cf88065d403d0e61022510769380b75">tthread::chrono</a>
</li>
<li>minutes
: <a class="el" href="namespacetthread_1_1chrono.html#a2a9e93851a6aee0eb47cc6379287ee16">tthread::chrono</a>
</li>
<li>nanoseconds
: <a class="el" href="namespacetthread_1_1chrono.html#a1396eccd0048d613bae0a745b55fa624">tthread::chrono</a>
</li>
<li>seconds
: <a class="el" href="namespacetthread_1_1chrono.html#a302ea2e096592e90ec58ccdcc6ec42c3">tthread::chrono</a>
</li>
<li>sleep_for()
: <a class="el" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398">tthread::this_thread</a>
</li>
<li>yield()
: <a class="el" href="namespacetthread_1_1this__thread.html#a867ef7ad1dd6026b7ee13bb013e00edd">tthread::this_thread</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li class="current"><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespacemembers.html"><span>All</span></a></li>
<li class="current"><a href="namespacemembers_func.html"><span>Functions</span></a></li>
<li><a href="namespacemembers_type.html"><span>Typedefs</span></a></li>
</ul>
</div>
</div>
<div class="contents">
&nbsp;<ul>
<li>get_id()
: <a class="el" href="namespacetthread_1_1this__thread.html#ab9370620a3920b9ec550f84fb44fb032">tthread::this_thread</a>
</li>
<li>sleep_for()
: <a class="el" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398">tthread::this_thread</a>
</li>
<li>yield()
: <a class="el" href="namespacetthread_1_1this__thread.html#a867ef7ad1dd6026b7ee13bb013e00edd">tthread::this_thread</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,60 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li class="current"><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespacemembers.html"><span>All</span></a></li>
<li><a href="namespacemembers_func.html"><span>Functions</span></a></li>
<li class="current"><a href="namespacemembers_type.html"><span>Typedefs</span></a></li>
</ul>
</div>
</div>
<div class="contents">
&nbsp;<ul>
<li>hours
: <a class="el" href="namespacetthread_1_1chrono.html#af212c337748be0da79f5a3a509f36cdf">tthread::chrono</a>
</li>
<li>microseconds
: <a class="el" href="namespacetthread_1_1chrono.html#add152055d7a764f3c1e5af1710f8814f">tthread::chrono</a>
</li>
<li>milliseconds
: <a class="el" href="namespacetthread_1_1chrono.html#a2cf88065d403d0e61022510769380b75">tthread::chrono</a>
</li>
<li>minutes
: <a class="el" href="namespacetthread_1_1chrono.html#a2a9e93851a6aee0eb47cc6379287ee16">tthread::chrono</a>
</li>
<li>nanoseconds
: <a class="el" href="namespacetthread_1_1chrono.html#a1396eccd0048d613bae0a745b55fa624">tthread::chrono</a>
</li>
<li>seconds
: <a class="el" href="namespacetthread_1_1chrono.html#a302ea2e096592e90ec58ccdcc6ec42c3">tthread::chrono</a>
</li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: Namespace Index</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>Namespace List</h1>Here is a list of all documented namespaces with brief descriptions:<table>
<tr><td class="indexkey"><a class="el" href="namespacetthread.html">tthread</a></td><td class="indexvalue">Main name space for TinyThread++ </td></tr>
<tr><td class="indexkey"><a class="el" href="namespacetthread_1_1chrono.html">tthread::chrono</a></td><td class="indexvalue">Minimal implementation of the <code>chrono</code> namespace </td></tr>
<tr><td class="indexkey"><a class="el" href="namespacetthread_1_1this__thread.html">tthread::this_thread</a></td><td class="indexvalue">The namespace <code><a class="el" href="namespacetthread_1_1this__thread.html" title="The namespace this_thread provides methods for dealing with the calling thread.">this_thread</a></code> provides methods for dealing with the calling thread </td></tr>
</table>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,67 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: tthread Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>tthread Namespace Reference</h1>
<p>Main name space for TinyThread++.
<a href="#_details">More...</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Namespaces</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html">chrono</a></td></tr>
<p><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p>Minimal implementation of the <code>chrono</code> namespace. </p>
<br/></td></tr>
</p>
<tr><td class="memItemLeft" align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html">this_thread</a></td></tr>
<p><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p>The namespace <code><a class="el" href="namespacetthread_1_1this__thread.html" title="The namespace this_thread provides methods for dealing with the calling thread.">this_thread</a></code> provides methods for dealing with the calling thread. </p>
<br/></td></tr>
</p>
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1fast__mutex.html">fast_mutex</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Fast mutex class. <a href="classtthread_1_1fast__mutex.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html">mutex</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Mutex class. <a href="classtthread_1_1mutex.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Recursive mutex class. <a href="classtthread_1_1recursive__mutex.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1lock__guard.html">lock_guard</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Lock guard class. <a href="classtthread_1_1lock__guard.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Condition variable class. <a href="classtthread_1_1condition__variable.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html">thread</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Thread class. <a href="classtthread_1_1thread.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1ratio.html">ratio</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Minimal implementation of the <code>ratio</code> class. <a href="classtthread_1_1ratio.html#_details">More...</a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Main name space for TinyThread++. </p>
<p>This namespace is more or less equivalent to the <code>std</code> namespace for the C++0x thread classes. For instance, the <a class="el" href="classtthread_1_1mutex.html" title="Mutex class.">tthread::mutex</a> class corresponds to the std::mutex class. </p>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,70 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: tthread::chrono Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="namespacetthread_1_1chrono.html">chrono</a>
</div>
</div>
<div class="contents">
<h1>tthread::chrono Namespace Reference</h1>
<p>Minimal implementation of the <code>chrono</code> namespace.
<a href="#_details">More...</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration template class. <a href="classtthread_1_1chrono_1_1duration.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1396eccd0048d613bae0a745b55fa624"></a><!-- doxytag: member="tthread::chrono::nanoseconds" ref="a1396eccd0048d613bae0a745b55fa624" args="" -->
typedef <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>&lt; __intmax_t, <br class="typebreak"/>
<a class="el" href="classtthread_1_1ratio.html">ratio</a>&lt; 1, 1000000000 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a1396eccd0048d613bae0a745b55fa624">nanoseconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit nanoseconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="add152055d7a764f3c1e5af1710f8814f"></a><!-- doxytag: member="tthread::chrono::microseconds" ref="add152055d7a764f3c1e5af1710f8814f" args="" -->
typedef <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>&lt; __intmax_t, <br class="typebreak"/>
<a class="el" href="classtthread_1_1ratio.html">ratio</a>&lt; 1, 1000000 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#add152055d7a764f3c1e5af1710f8814f">microseconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit microseconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2cf88065d403d0e61022510769380b75"></a><!-- doxytag: member="tthread::chrono::milliseconds" ref="a2cf88065d403d0e61022510769380b75" args="" -->
typedef <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>&lt; __intmax_t, <br class="typebreak"/>
<a class="el" href="classtthread_1_1ratio.html">ratio</a>&lt; 1, 1000 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a2cf88065d403d0e61022510769380b75">milliseconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit milliseconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a302ea2e096592e90ec58ccdcc6ec42c3"></a><!-- doxytag: member="tthread::chrono::seconds" ref="a302ea2e096592e90ec58ccdcc6ec42c3" args="" -->
typedef <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>&lt; __intmax_t &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a302ea2e096592e90ec58ccdcc6ec42c3">seconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit seconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a9e93851a6aee0eb47cc6379287ee16"></a><!-- doxytag: member="tthread::chrono::minutes" ref="a2a9e93851a6aee0eb47cc6379287ee16" args="" -->
typedef <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>&lt; __intmax_t, <br class="typebreak"/>
<a class="el" href="classtthread_1_1ratio.html">ratio</a>&lt; 60 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a2a9e93851a6aee0eb47cc6379287ee16">minutes</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit minutes. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af212c337748be0da79f5a3a509f36cdf"></a><!-- doxytag: member="tthread::chrono::hours" ref="af212c337748be0da79f5a3a509f36cdf" args="" -->
typedef <a class="el" href="classtthread_1_1chrono_1_1duration.html">duration</a>&lt; __intmax_t, <br class="typebreak"/>
<a class="el" href="classtthread_1_1ratio.html">ratio</a>&lt; 3600 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#af212c337748be0da79f5a3a509f36cdf">hours</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit hours. <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Minimal implementation of the <code>chrono</code> namespace. </p>
<p>The <code>chrono</code> namespace provides types for specifying time intervals. </p>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,102 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: tthread::this_thread Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="namespaces.html"><span>Namespace&nbsp;List</span></a></li>
<li><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacetthread.html">tthread</a>::<a class="el" href="namespacetthread_1_1this__thread.html">this_thread</a>
</div>
</div>
<div class="contents">
<h1>tthread::this_thread Namespace Reference</h1>
<p>The namespace <code><a class="el" href="namespacetthread_1_1this__thread.html" title="The namespace this_thread provides methods for dealing with the calling thread.">this_thread</a></code> provides methods for dealing with the calling thread.
<a href="#_details">More...</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab9370620a3920b9ec550f84fb44fb032"></a><!-- doxytag: member="tthread::this_thread::get_id" ref="ab9370620a3920b9ec550f84fb44fb032" args="()" -->
<a class="el" href="classtthread_1_1thread_1_1id.html">thread::id</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html#ab9370620a3920b9ec550f84fb44fb032">get_id</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the thread ID of the calling thread. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html#a867ef7ad1dd6026b7ee13bb013e00edd">yield</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Yield execution to another thread. <a href="#a867ef7ad1dd6026b7ee13bb013e00edd"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;class _Rep , class _Period &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398">sleep_for</a> (const <a class="el" href="classtthread_1_1chrono_1_1duration.html">chrono::duration</a>&lt; _Rep, _Period &gt; &amp;aTime)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Blocks the calling thread for a period of time. <a href="#acba48c6dbf12d38ab816c18c1ef96398"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>The namespace <code><a class="el" href="namespacetthread_1_1this__thread.html" title="The namespace this_thread provides methods for dealing with the calling thread.">this_thread</a></code> provides methods for dealing with the calling thread. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="acba48c6dbf12d38ab816c18c1ef96398"></a><!-- doxytag: member="tthread::this_thread::sleep_for" ref="acba48c6dbf12d38ab816c18c1ef96398" args="(const chrono::duration&lt; _Rep, _Period &gt; &amp;aTime)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void tthread::this_thread::sleep_for </td>
<td>(</td>
<td class="paramtype">const chrono::duration&lt; _Rep, _Period &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>aTime</em></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Blocks the calling thread for a period of time. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>aTime</em>&nbsp;</td><td>Minimum time to put the thread to sleep. Example usage: </p>
<div class="fragment"><pre class="fragment"> <span class="comment">// Sleep for 100 milliseconds</span>
<a class="code" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398" title="Blocks the calling thread for a period of time.">this_thread::sleep_for</a>(<a class="code" href="namespacetthread_1_1chrono.html#a2cf88065d403d0e61022510769380b75" title="Duration with the unit milliseconds.">chrono::milliseconds</a>(100));
</pre></div> </td></tr>
</table>
</dd>
</dl>
<dl class="note"><dt><b>Note:</b></dt><dd>Supported duration types are: nanoseconds, microseconds, milliseconds, seconds, minutes and hours. </dd></dl>
</div>
</div>
<a class="anchor" id="a867ef7ad1dd6026b7ee13bb013e00edd"></a><!-- doxytag: member="tthread::this_thread::yield" ref="a867ef7ad1dd6026b7ee13bb013e00edd" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void tthread::this_thread::yield </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Yield execution to another thread. </p>
<p>Offers the operating system the opportunity to schedule another thread that is ready to run on the current processor. </p>
</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:34 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

BIN
external/TinyThread/doc/html/tab_b.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 B

BIN
external/TinyThread/doc/html/tab_l.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

BIN
external/TinyThread/doc/html/tab_r.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

105
external/TinyThread/doc/html/tabs.css vendored Normal file
View file

@ -0,0 +1,105 @@
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
DIV.tabs
{
float : left;
width : 100%;
background : url("tab_b.gif") repeat-x bottom;
margin-bottom : 4px;
}
DIV.tabs UL
{
margin : 0px;
padding-left : 10px;
list-style : none;
}
DIV.tabs LI, DIV.tabs FORM
{
display : inline;
margin : 0px;
padding : 0px;
}
DIV.tabs FORM
{
float : right;
}
DIV.tabs A
{
float : left;
background : url("tab_r.gif") no-repeat right top;
border-bottom : 1px solid #84B0C7;
font-size : 80%;
font-weight : bold;
text-decoration : none;
}
DIV.tabs A:hover
{
background-position: 100% -150px;
}
DIV.tabs A:link, DIV.tabs A:visited,
DIV.tabs A:active, DIV.tabs A:hover
{
color: #1A419D;
}
DIV.tabs SPAN
{
float : left;
display : block;
background : url("tab_l.gif") no-repeat left top;
padding : 5px 9px;
white-space : nowrap;
}
DIV.tabs #MSearchBox
{
float : right;
display : inline;
font-size : 1em;
}
DIV.tabs TD
{
font-size : 80%;
font-weight : bold;
text-decoration : none;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
DIV.tabs SPAN {float : none;}
/* End IE5-Mac hack */
DIV.tabs A:hover SPAN
{
background-position: 0% -150px;
}
DIV.tabs LI.current A
{
background-position: 100% -150px;
border-width : 0px;
}
DIV.tabs LI.current SPAN
{
background-position: 0% -150px;
padding-bottom : 6px;
}
DIV.navpath
{
background : none;
border : none;
border-bottom : 1px solid #84B0C7;
text-align : center;
margin : 2px;
padding : 2px;
}

View file

@ -0,0 +1,143 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: tinythread.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>tinythread.h File Reference</h1><code>#include &lt;pthread.h&gt;</code><br/>
<code>#include &lt;signal.h&gt;</code><br/>
<code>#include &lt;sched.h&gt;</code><br/>
<code>#include &lt;unistd.h&gt;</code><br/>
<code>#include &lt;ostream&gt;</code><br/>
<p><a href="tinythread_8h_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1mutex.html">mutex</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Mutex class. <a href="classtthread_1_1mutex.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1recursive__mutex.html">recursive_mutex</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Recursive mutex class. <a href="classtthread_1_1recursive__mutex.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1lock__guard.html">lock_guard&lt; T &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Lock guard class. <a href="classtthread_1_1lock__guard.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1condition__variable.html">condition_variable</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Condition variable class. <a href="classtthread_1_1condition__variable.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread.html">thread</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Thread class. <a href="classtthread_1_1thread.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1thread_1_1id.html">id</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Thread ID. <a href="classtthread_1_1thread_1_1id.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1ratio.html">ratio&lt; N, D &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Minimal implementation of the <code>ratio</code> class. <a href="classtthread_1_1ratio.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtthread_1_1chrono_1_1duration.html">duration&lt; _Rep, _Period &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration template class. <a href="classtthread_1_1chrono_1_1duration.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Namespaces</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread.html">tthread</a></td></tr>
<p><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p>Main name space for TinyThread++. </p>
<br/></td></tr>
</p>
<tr><td class="memItemLeft" align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html">tthread::chrono</a></td></tr>
<p><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p>Minimal implementation of the <code>chrono</code> namespace. </p>
<br/></td></tr>
</p>
<tr><td class="memItemLeft" align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html">tthread::this_thread</a></td></tr>
<p><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p>The namespace <code><a class="el" href="namespacetthread_1_1this__thread.html" title="The namespace this_thread provides methods for dealing with the calling thread.">this_thread</a></code> provides methods for dealing with the calling thread. </p>
<br/></td></tr>
</p>
<tr><td colspan="2"><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af1d2d7842598b143f8e0a54a9b6f5bec"></a><!-- doxytag: member="tinythread.h::TINYTHREAD_VERSION_MAJOR" ref="af1d2d7842598b143f8e0a54a9b6f5bec" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="tinythread_8h.html#af1d2d7842598b143f8e0a54a9b6f5bec">TINYTHREAD_VERSION_MAJOR</a>&nbsp;&nbsp;&nbsp;1</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">TinyThread++ version (major number). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9248a2e6daaeb43e46bd632417cb4733"></a><!-- doxytag: member="tinythread.h::TINYTHREAD_VERSION_MINOR" ref="a9248a2e6daaeb43e46bd632417cb4733" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="tinythread_8h.html#a9248a2e6daaeb43e46bd632417cb4733">TINYTHREAD_VERSION_MINOR</a>&nbsp;&nbsp;&nbsp;0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">TinyThread++ version (minor number). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9a3d5a9159f22201a37dd59d82b1861f"></a><!-- doxytag: member="tinythread.h::TINYTHREAD_VERSION" ref="a9a3d5a9159f22201a37dd59d82b1861f" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="tinythread_8h.html#a9a3d5a9159f22201a37dd59d82b1861f">TINYTHREAD_VERSION</a>&nbsp;&nbsp;&nbsp;(TINYTHREAD_VERSION_MAJOR * 100 + TINYTHREAD_VERSION_MINOR)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">TinyThread++ version (full version). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="tinythread_8h.html#ad4d9b405bcbffaf0d4dae6166c18aa1e">thread_local</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Thread local storage keyword. <a href="#ad4d9b405bcbffaf0d4dae6166c18aa1e"></a><br/></td></tr>
<tr><td colspan="2"><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1396eccd0048d613bae0a745b55fa624"></a><!-- doxytag: member="tinythread.h::nanoseconds" ref="a1396eccd0048d613bae0a745b55fa624" args="" -->
typedef duration&lt; __intmax_t, <br class="typebreak"/>
ratio&lt; 1, 1000000000 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a1396eccd0048d613bae0a745b55fa624">nanoseconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit nanoseconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="add152055d7a764f3c1e5af1710f8814f"></a><!-- doxytag: member="tinythread.h::microseconds" ref="add152055d7a764f3c1e5af1710f8814f" args="" -->
typedef duration&lt; __intmax_t, <br class="typebreak"/>
ratio&lt; 1, 1000000 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#add152055d7a764f3c1e5af1710f8814f">microseconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit microseconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2cf88065d403d0e61022510769380b75"></a><!-- doxytag: member="tinythread.h::milliseconds" ref="a2cf88065d403d0e61022510769380b75" args="" -->
typedef duration&lt; __intmax_t, <br class="typebreak"/>
ratio&lt; 1, 1000 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a2cf88065d403d0e61022510769380b75">milliseconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit milliseconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a302ea2e096592e90ec58ccdcc6ec42c3"></a><!-- doxytag: member="tinythread.h::seconds" ref="a302ea2e096592e90ec58ccdcc6ec42c3" args="" -->
typedef duration&lt; __intmax_t &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a302ea2e096592e90ec58ccdcc6ec42c3">seconds</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit seconds. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a9e93851a6aee0eb47cc6379287ee16"></a><!-- doxytag: member="tinythread.h::minutes" ref="a2a9e93851a6aee0eb47cc6379287ee16" args="" -->
typedef duration&lt; __intmax_t, <br class="typebreak"/>
ratio&lt; 60 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#a2a9e93851a6aee0eb47cc6379287ee16">minutes</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit minutes. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af212c337748be0da79f5a3a509f36cdf"></a><!-- doxytag: member="tinythread.h::hours" ref="af212c337748be0da79f5a3a509f36cdf" args="" -->
typedef duration&lt; __intmax_t, <br class="typebreak"/>
ratio&lt; 3600 &gt; &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1chrono.html#af212c337748be0da79f5a3a509f36cdf">hours</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Duration with the unit hours. <br/></td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab9370620a3920b9ec550f84fb44fb032"></a><!-- doxytag: member="tinythread.h::get_id" ref="ab9370620a3920b9ec550f84fb44fb032" args="()" -->
thread::id&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html#ab9370620a3920b9ec550f84fb44fb032">get_id</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the thread ID of the calling thread. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html#a867ef7ad1dd6026b7ee13bb013e00edd">yield</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Yield execution to another thread. <a href="#a867ef7ad1dd6026b7ee13bb013e00edd"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;class _Rep , class _Period &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398">sleep_for</a> (const chrono::duration&lt; _Rep, _Period &gt; &amp;aTime)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Blocks the calling thread for a period of time. <a href="#acba48c6dbf12d38ab816c18c1ef96398"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ad4d9b405bcbffaf0d4dae6166c18aa1e"></a><!-- doxytag: member="tinythread.h::thread_local" ref="ad4d9b405bcbffaf0d4dae6166c18aa1e" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define thread_local</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Thread local storage keyword. </p>
<p>A variable that is declared with the <code>thread_local</code> keyword makes the value of the variable local to each thread (known as thread-local storage, or TLS). Example usage: </p>
<div class="fragment"><pre class="fragment"> <span class="comment">// This variable is local to each thread.</span>
<a class="code" href="tinythread_8h.html#ad4d9b405bcbffaf0d4dae6166c18aa1e" title="Thread local storage keyword.">thread_local</a> <span class="keywordtype">int</span> variable;
</pre></div> <dl class="note"><dt><b>Note:</b></dt><dd>The <code>thread_local</code> keyword is a macro that maps to the corresponding compiler directive (e.g. <code>__declspec(thread)</code>). While the C++0x standard allows for non-trivial types (e.g. classes with constructors and destructors) to be declared with the <code>thread_local</code> keyword, most pre-C++0x compilers only allow for trivial types (e.g. <code>int</code>). So, to guarantee portable code, only use trivial types for thread local storage. </dd>
<dd>
This directive is currently not supported on Mac OS X (it will give a compiler error), since compile-time TLS is not supported in the Mac OS X executable format. Also, some older versions of MinGW (before GCC 4.x) do not support this directive. </dd></dl>
</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

View file

@ -0,0 +1,517 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: tinythread.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<h1>tinythread.h</h1><a href="tinythread_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">Copyright (c) 2010 Marcus Geelnard</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span>
<a name="l00005"></a>00005 <span class="comment">warranty. In no event will the authors be held liable for any damages</span>
<a name="l00006"></a>00006 <span class="comment">arising from the use of this software.</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00009"></a>00009 <span class="comment">including commercial applications, and to alter it and redistribute it</span>
<a name="l00010"></a>00010 <span class="comment">freely, subject to the following restrictions:</span>
<a name="l00011"></a>00011 <span class="comment"></span>
<a name="l00012"></a>00012 <span class="comment"> 1. The origin of this software must not be misrepresented; you must not</span>
<a name="l00013"></a>00013 <span class="comment"> claim that you wrote the original software. If you use this software</span>
<a name="l00014"></a>00014 <span class="comment"> in a product, an acknowledgment in the product documentation would be</span>
<a name="l00015"></a>00015 <span class="comment"> appreciated but is not required.</span>
<a name="l00016"></a>00016 <span class="comment"></span>
<a name="l00017"></a>00017 <span class="comment"> 2. Altered source versions must be plainly marked as such, and must not be</span>
<a name="l00018"></a>00018 <span class="comment"> misrepresented as being the original software.</span>
<a name="l00019"></a>00019 <span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment"> 3. This notice may not be removed or altered from any source</span>
<a name="l00021"></a>00021 <span class="comment"> distribution.</span>
<a name="l00022"></a>00022 <span class="comment">*/</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef _TINYTHREAD_H_</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define _TINYTHREAD_H_</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00057"></a>00057
<a name="l00058"></a>00058 <span class="comment">// Which platform are we on?</span>
<a name="l00059"></a>00059 <span class="preprocessor">#if !defined(_TTHREAD_PLATFORM_DEFINED_)</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor"> #if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__)</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_WIN32_</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor"> #else</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_POSIX_</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_PLATFORM_DEFINED_</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span>
<a name="l00068"></a>00068 <span class="comment">// Platform specific includes</span>
<a name="l00069"></a>00069 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor"> #include &lt;windows.h&gt;</span>
<a name="l00071"></a>00071 <span class="preprocessor">#else</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor"> #include &lt;pthread.h&gt;</span>
<a name="l00073"></a>00073 <span class="preprocessor"> #include &lt;signal.h&gt;</span>
<a name="l00074"></a>00074 <span class="preprocessor"> #include &lt;sched.h&gt;</span>
<a name="l00075"></a>00075 <span class="preprocessor"> #include &lt;unistd.h&gt;</span>
<a name="l00076"></a>00076 <span class="preprocessor">#endif</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span>
<a name="l00078"></a>00078 <span class="comment">// Generic includes</span>
<a name="l00079"></a>00079 <span class="preprocessor">#include &lt;ostream&gt;</span>
<a name="l00080"></a>00080
<a name="l00082"></a><a class="code" href="tinythread_8h.html#af1d2d7842598b143f8e0a54a9b6f5bec">00082</a> <span class="preprocessor">#define TINYTHREAD_VERSION_MAJOR 1</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span>
<a name="l00084"></a><a class="code" href="tinythread_8h.html#a9248a2e6daaeb43e46bd632417cb4733">00084</a> <span class="preprocessor">#define TINYTHREAD_VERSION_MINOR 0</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span>
<a name="l00086"></a><a class="code" href="tinythread_8h.html#a9a3d5a9159f22201a37dd59d82b1861f">00086</a> <span class="preprocessor">#define TINYTHREAD_VERSION (TINYTHREAD_VERSION_MAJOR * 100 + TINYTHREAD_VERSION_MINOR)</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>
<a name="l00088"></a>00088 <span class="comment">// Do we have a fully featured C++0x compiler?</span>
<a name="l00089"></a>00089 <span class="preprocessor">#if (__cplusplus &gt; 199711L) || (defined(__STDCXX_VERSION__) &amp;&amp; (__STDCXX_VERSION__ &gt;= 201001L))</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_CPP0X_</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span>
<a name="l00093"></a>00093 <span class="comment">// ...at least partial C++0x?</span>
<a name="l00094"></a>00094 <span class="preprocessor">#if defined(_TTHREAD_CPP0X_) || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_CPP0X_PARTIAL_</span>
<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span>
<a name="l00098"></a>00098 <span class="comment">// Macro for disabling assignments of objects.</span>
<a name="l00099"></a>00099 <span class="preprocessor">#ifdef _TTHREAD_CPP0X_PARTIAL_</span>
<a name="l00100"></a>00100 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_DISABLE_ASSIGNMENT(name) \</span>
<a name="l00101"></a>00101 <span class="preprocessor"> name(const name&amp;) = delete; \</span>
<a name="l00102"></a>00102 <span class="preprocessor"> name&amp; operator=(const name&amp;) = delete;</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor"> #define _TTHREAD_DISABLE_ASSIGNMENT(name) \</span>
<a name="l00105"></a>00105 <span class="preprocessor"> name(const name&amp;); \</span>
<a name="l00106"></a>00106 <span class="preprocessor"> name&amp; operator=(const name&amp;);</span>
<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span>
<a name="l00129"></a>00129
<a name="l00130"></a>00130 <span class="preprocessor">#if !defined(_TTHREAD_CPP0X_) &amp;&amp; !defined(thread_local)</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor"> #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)</span>
<a name="l00132"></a>00132 <span class="preprocessor"></span><span class="preprocessor"> #define thread_local __thread</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span><span class="preprocessor"> #else</span>
<a name="l00134"></a><a class="code" href="tinythread_8h.html#ad4d9b405bcbffaf0d4dae6166c18aa1e">00134</a> <span class="preprocessor"></span><span class="preprocessor"> #define thread_local __declspec(thread)</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
<a name="l00136"></a>00136 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span>
<a name="l00138"></a>00138
<a name="l00143"></a>00143 <span class="keyword">namespace </span>tthread {
<a name="l00144"></a>00144
<a name="l00151"></a><a class="code" href="classtthread_1_1mutex.html">00151</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1mutex.html" title="Mutex class.">mutex</a> {
<a name="l00152"></a>00152 <span class="keyword">public</span>:
<a name="l00154"></a><a class="code" href="classtthread_1_1mutex.html#aef42e2bd0ea2ffa8ce1cdc7e5d183910">00154</a> <a class="code" href="classtthread_1_1mutex.html#aef42e2bd0ea2ffa8ce1cdc7e5d183910" title="Constructor.">mutex</a>()
<a name="l00155"></a>00155 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00156"></a>00156 <span class="preprocessor"></span> : mAlreadyLocked(<span class="keyword">false</span>)
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
<a name="l00158"></a>00158 <span class="preprocessor"></span> {
<a name="l00159"></a>00159 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00160"></a>00160 <span class="preprocessor"></span> InitializeCriticalSection(&amp;mHandle);
<a name="l00161"></a>00161 <span class="preprocessor">#else</span>
<a name="l00162"></a>00162 <span class="preprocessor"></span> pthread_mutex_init(&amp;mHandle, NULL);
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
<a name="l00164"></a>00164 <span class="preprocessor"></span> }
<a name="l00165"></a>00165
<a name="l00167"></a><a class="code" href="classtthread_1_1mutex.html#a3ab9328c3addeb57045f45910b10a1cf">00167</a> <a class="code" href="classtthread_1_1mutex.html#a3ab9328c3addeb57045f45910b10a1cf" title="Destructor.">~mutex</a>()
<a name="l00168"></a>00168 {
<a name="l00169"></a>00169 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span> DeleteCriticalSection(&amp;mHandle);
<a name="l00171"></a>00171 <span class="preprocessor">#else</span>
<a name="l00172"></a>00172 <span class="preprocessor"></span> pthread_mutex_destroy(&amp;mHandle);
<a name="l00173"></a>00173 <span class="preprocessor">#endif</span>
<a name="l00174"></a>00174 <span class="preprocessor"></span> }
<a name="l00175"></a>00175
<a name="l00180"></a><a class="code" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d">00180</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1mutex.html#aa81aed607133209dade63a226818224d" title="Lock the mutex.">lock</a>()
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00183"></a>00183 <span class="preprocessor"></span> EnterCriticalSection(&amp;mHandle);
<a name="l00184"></a>00184 <span class="keywordflow">while</span>(mAlreadyLocked) Sleep(1000); <span class="comment">// Simulate deadlock...</span>
<a name="l00185"></a>00185 mAlreadyLocked = <span class="keyword">true</span>;
<a name="l00186"></a>00186 <span class="preprocessor">#else</span>
<a name="l00187"></a>00187 <span class="preprocessor"></span> pthread_mutex_lock(&amp;mHandle);
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
<a name="l00189"></a>00189 <span class="preprocessor"></span> }
<a name="l00190"></a>00190
<a name="l00196"></a><a class="code" href="classtthread_1_1mutex.html#aa24a64f788f142df670c3abc809d32b6">00196</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classtthread_1_1mutex.html#aa24a64f788f142df670c3abc809d32b6" title="Try to lock the mutex.">try_lock</a>()
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00199"></a>00199 <span class="preprocessor"></span> <span class="keywordtype">bool</span> ret = (TryEnterCriticalSection(&amp;mHandle) ? <span class="keyword">true</span> : <span class="keyword">false</span>);
<a name="l00200"></a>00200 <span class="keywordflow">if</span>(ret &amp;&amp; mAlreadyLocked)
<a name="l00201"></a>00201 {
<a name="l00202"></a>00202 LeaveCriticalSection(&amp;mHandle);
<a name="l00203"></a>00203 ret = <span class="keyword">false</span>;
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 <span class="keywordflow">return</span> ret;
<a name="l00206"></a>00206 <span class="preprocessor">#else</span>
<a name="l00207"></a>00207 <span class="preprocessor"></span> <span class="keywordflow">return</span> (pthread_mutex_trylock(&amp;mHandle) == 0) ? <span class="keyword">true</span> : <span class="keyword">false</span>;
<a name="l00208"></a>00208 <span class="preprocessor">#endif</span>
<a name="l00209"></a>00209 <span class="preprocessor"></span> }
<a name="l00210"></a>00210
<a name="l00214"></a><a class="code" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403">00214</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1mutex.html#a9278be8203e1c42e2619179882ae4403" title="Unlock the mutex.">unlock</a>()
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00217"></a>00217 <span class="preprocessor"></span> mAlreadyLocked = <span class="keyword">false</span>;
<a name="l00218"></a>00218 LeaveCriticalSection(&amp;mHandle);
<a name="l00219"></a>00219 <span class="preprocessor">#else</span>
<a name="l00220"></a>00220 <span class="preprocessor"></span> pthread_mutex_unlock(&amp;mHandle);
<a name="l00221"></a>00221 <span class="preprocessor">#endif</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span> }
<a name="l00223"></a>00223
<a name="l00224"></a>00224 _TTHREAD_DISABLE_ASSIGNMENT(<a class="code" href="classtthread_1_1mutex.html" title="Mutex class.">mutex</a>)
<a name="l00225"></a>00225
<a name="l00226"></a>00226 private:
<a name="l00227"></a>00227 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00228"></a>00228 <span class="preprocessor"></span> CRITICAL_SECTION mHandle;
<a name="l00229"></a>00229 <span class="keywordtype">bool</span> mAlreadyLocked;
<a name="l00230"></a>00230 <span class="preprocessor">#else</span>
<a name="l00231"></a>00231 <span class="preprocessor"></span> pthread_mutex_t mHandle;
<a name="l00232"></a>00232 <span class="preprocessor">#endif</span>
<a name="l00233"></a>00233 <span class="preprocessor"></span>
<a name="l00234"></a>00234 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classtthread_1_1condition__variable.html" title="Condition variable class.">condition_variable</a>;
<a name="l00235"></a>00235 };
<a name="l00236"></a>00236
<a name="l00243"></a><a class="code" href="classtthread_1_1recursive__mutex.html">00243</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1recursive__mutex.html" title="Recursive mutex class.">recursive_mutex</a> {
<a name="l00244"></a>00244 <span class="keyword">public</span>:
<a name="l00246"></a><a class="code" href="classtthread_1_1recursive__mutex.html#a612d33a8905a3de216a8be0467538ede">00246</a> <a class="code" href="classtthread_1_1recursive__mutex.html#a612d33a8905a3de216a8be0467538ede" title="Constructor.">recursive_mutex</a>()
<a name="l00247"></a>00247 {
<a name="l00248"></a>00248 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00249"></a>00249 <span class="preprocessor"></span> InitializeCriticalSection(&amp;mHandle);
<a name="l00250"></a>00250 <span class="preprocessor">#else</span>
<a name="l00251"></a>00251 <span class="preprocessor"></span> pthread_mutexattr_t attr;
<a name="l00252"></a>00252 pthread_mutexattr_init(&amp;attr);
<a name="l00253"></a>00253 pthread_mutexattr_settype(&amp;attr, PTHREAD_MUTEX_RECURSIVE);
<a name="l00254"></a>00254 pthread_mutex_init(&amp;mHandle, &amp;attr);
<a name="l00255"></a>00255 <span class="preprocessor">#endif</span>
<a name="l00256"></a>00256 <span class="preprocessor"></span> }
<a name="l00257"></a>00257
<a name="l00259"></a><a class="code" href="classtthread_1_1recursive__mutex.html#a571b16a7b52c4d1fb0bdb5ff0482c100">00259</a> <a class="code" href="classtthread_1_1recursive__mutex.html#a571b16a7b52c4d1fb0bdb5ff0482c100" title="Destructor.">~recursive_mutex</a>()
<a name="l00260"></a>00260 {
<a name="l00261"></a>00261 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00262"></a>00262 <span class="preprocessor"></span> DeleteCriticalSection(&amp;mHandle);
<a name="l00263"></a>00263 <span class="preprocessor">#else</span>
<a name="l00264"></a>00264 <span class="preprocessor"></span> pthread_mutex_destroy(&amp;mHandle);
<a name="l00265"></a>00265 <span class="preprocessor">#endif</span>
<a name="l00266"></a>00266 <span class="preprocessor"></span> }
<a name="l00267"></a>00267
<a name="l00272"></a><a class="code" href="classtthread_1_1recursive__mutex.html#aa81aed607133209dade63a226818224d">00272</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1recursive__mutex.html#aa81aed607133209dade63a226818224d" title="Lock the mutex.">lock</a>()
<a name="l00273"></a>00273 {
<a name="l00274"></a>00274 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00275"></a>00275 <span class="preprocessor"></span> EnterCriticalSection(&amp;mHandle);
<a name="l00276"></a>00276 <span class="preprocessor">#else</span>
<a name="l00277"></a>00277 <span class="preprocessor"></span> pthread_mutex_lock(&amp;mHandle);
<a name="l00278"></a>00278 <span class="preprocessor">#endif</span>
<a name="l00279"></a>00279 <span class="preprocessor"></span> }
<a name="l00280"></a>00280
<a name="l00286"></a><a class="code" href="classtthread_1_1recursive__mutex.html#aa24a64f788f142df670c3abc809d32b6">00286</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classtthread_1_1recursive__mutex.html#aa24a64f788f142df670c3abc809d32b6" title="Try to lock the mutex.">try_lock</a>()
<a name="l00287"></a>00287 {
<a name="l00288"></a>00288 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00289"></a>00289 <span class="preprocessor"></span> <span class="keywordflow">return</span> TryEnterCriticalSection(&amp;mHandle) ? <span class="keyword">true</span> : <span class="keyword">false</span>;
<a name="l00290"></a>00290 <span class="preprocessor">#else</span>
<a name="l00291"></a>00291 <span class="preprocessor"></span> <span class="keywordflow">return</span> (pthread_mutex_trylock(&amp;mHandle) == 0) ? <span class="keyword">true</span> : <span class="keyword">false</span>;
<a name="l00292"></a>00292 <span class="preprocessor">#endif</span>
<a name="l00293"></a>00293 <span class="preprocessor"></span> }
<a name="l00294"></a>00294
<a name="l00298"></a><a class="code" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403">00298</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1recursive__mutex.html#a9278be8203e1c42e2619179882ae4403" title="Unlock the mutex.">unlock</a>()
<a name="l00299"></a>00299 {
<a name="l00300"></a>00300 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00301"></a>00301 <span class="preprocessor"></span> LeaveCriticalSection(&amp;mHandle);
<a name="l00302"></a>00302 <span class="preprocessor">#else</span>
<a name="l00303"></a>00303 <span class="preprocessor"></span> pthread_mutex_unlock(&amp;mHandle);
<a name="l00304"></a>00304 <span class="preprocessor">#endif</span>
<a name="l00305"></a>00305 <span class="preprocessor"></span> }
<a name="l00306"></a>00306
<a name="l00307"></a>00307 _TTHREAD_DISABLE_ASSIGNMENT(<a class="code" href="classtthread_1_1recursive__mutex.html" title="Recursive mutex class.">recursive_mutex</a>)
<a name="l00308"></a>00308
<a name="l00309"></a>00309 private:
<a name="l00310"></a>00310 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00311"></a>00311 <span class="preprocessor"></span> CRITICAL_SECTION mHandle;
<a name="l00312"></a>00312 <span class="preprocessor">#else</span>
<a name="l00313"></a>00313 <span class="preprocessor"></span> pthread_mutex_t mHandle;
<a name="l00314"></a>00314 <span class="preprocessor">#endif</span>
<a name="l00315"></a>00315 <span class="preprocessor"></span>
<a name="l00316"></a>00316 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classtthread_1_1condition__variable.html" title="Condition variable class.">condition_variable</a>;
<a name="l00317"></a>00317 };
<a name="l00318"></a>00318
<a name="l00333"></a>00333
<a name="l00334"></a>00334 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00335"></a><a class="code" href="classtthread_1_1lock__guard.html">00335</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a> {
<a name="l00336"></a>00336 <span class="keyword">public</span>:
<a name="l00337"></a>00337 <span class="keyword">typedef</span> T mutex_type;
<a name="l00338"></a>00338
<a name="l00339"></a>00339 <a class="code" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a>() : mMutex(0) {}
<a name="l00340"></a>00340
<a name="l00342"></a><a class="code" href="classtthread_1_1lock__guard.html#a2c5fd14427acb035def5201e4cfd4540">00342</a> <span class="keyword">explicit</span> <a class="code" href="classtthread_1_1lock__guard.html" title="Lock guard class.">lock_guard</a>(mutex_type &amp;aMutex)
<a name="l00343"></a>00343 {
<a name="l00344"></a>00344 mMutex = &amp;aMutex;
<a name="l00345"></a>00345 mMutex-&gt;lock();
<a name="l00346"></a>00346 }
<a name="l00347"></a>00347
<a name="l00349"></a><a class="code" href="classtthread_1_1lock__guard.html#aa54999fb933a139807d39ed05e97aa6d">00349</a> <a class="code" href="classtthread_1_1lock__guard.html#aa54999fb933a139807d39ed05e97aa6d" title="The destructor unlocks the mutex.">~lock_guard</a>()
<a name="l00350"></a>00350 {
<a name="l00351"></a>00351 <span class="keywordflow">if</span>(mMutex)
<a name="l00352"></a>00352 mMutex-&gt;unlock();
<a name="l00353"></a>00353 }
<a name="l00354"></a>00354
<a name="l00355"></a>00355 <span class="keyword">private</span>:
<a name="l00356"></a>00356 mutex_type * mMutex;
<a name="l00357"></a>00357 };
<a name="l00358"></a>00358
<a name="l00384"></a><a class="code" href="classtthread_1_1condition__variable.html">00384</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1condition__variable.html" title="Condition variable class.">condition_variable</a> {
<a name="l00385"></a>00385 <span class="keyword">public</span>:
<a name="l00387"></a>00387 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00388"></a>00388 <span class="preprocessor"></span> <a class="code" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9" title="Constructor.">condition_variable</a>();
<a name="l00389"></a>00389 <span class="preprocessor">#else</span>
<a name="l00390"></a><a class="code" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9">00390</a> <span class="preprocessor"></span> <a class="code" href="classtthread_1_1condition__variable.html#a9e62a1d1145c820a02469a48099fdfa9" title="Constructor.">condition_variable</a>()
<a name="l00391"></a>00391 {
<a name="l00392"></a>00392 pthread_cond_init(&amp;mHandle, NULL);
<a name="l00393"></a>00393 }
<a name="l00394"></a>00394 <span class="preprocessor">#endif</span>
<a name="l00395"></a>00395 <span class="preprocessor"></span>
<a name="l00397"></a>00397 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00398"></a>00398 <span class="preprocessor"></span> <a class="code" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b" title="Destructor.">~condition_variable</a>();
<a name="l00399"></a>00399 <span class="preprocessor">#else</span>
<a name="l00400"></a><a class="code" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b">00400</a> <span class="preprocessor"></span> <a class="code" href="classtthread_1_1condition__variable.html#a58df09046f5006d4170ae92717f1e50b" title="Destructor.">~condition_variable</a>()
<a name="l00401"></a>00401 {
<a name="l00402"></a>00402 pthread_cond_destroy(&amp;mHandle);
<a name="l00403"></a>00403 }
<a name="l00404"></a>00404 <span class="preprocessor">#endif</span>
<a name="l00405"></a>00405 <span class="preprocessor"></span>
<a name="l00411"></a>00411 <span class="keyword">template</span> &lt;<span class="keyword">class</span> _mutexT&gt;
<a name="l00412"></a><a class="code" href="classtthread_1_1condition__variable.html#a4d877d804385bde4aacf2156e86faede">00412</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1condition__variable.html#a4d877d804385bde4aacf2156e86faede" title="Wait for the condition.">wait</a>(_mutexT &amp;aMutex)
<a name="l00413"></a>00413 {
<a name="l00414"></a>00414 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00415"></a>00415 <span class="preprocessor"></span> <span class="comment">// Increment number of waiters</span>
<a name="l00416"></a>00416 EnterCriticalSection(&amp;mWaitersCountLock);
<a name="l00417"></a>00417 ++ mWaitersCount;
<a name="l00418"></a>00418 LeaveCriticalSection(&amp;mWaitersCountLock);
<a name="l00419"></a>00419
<a name="l00420"></a>00420 <span class="comment">// Release the mutex while waiting for the condition (will decrease</span>
<a name="l00421"></a>00421 <span class="comment">// the number of waiters when done)...</span>
<a name="l00422"></a>00422 aMutex.unlock();
<a name="l00423"></a>00423 _wait();
<a name="l00424"></a>00424 aMutex.lock();
<a name="l00425"></a>00425 <span class="preprocessor">#else</span>
<a name="l00426"></a>00426 <span class="preprocessor"></span> pthread_cond_wait(&amp;mHandle, &amp;aMutex.mHandle);
<a name="l00427"></a>00427 <span class="preprocessor">#endif</span>
<a name="l00428"></a>00428 <span class="preprocessor"></span> }
<a name="l00429"></a>00429
<a name="l00435"></a>00435 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00436"></a>00436 <span class="preprocessor"></span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394" title="Notify one thread that is waiting for the condition.">notify_one</a>();
<a name="l00437"></a>00437 <span class="preprocessor">#else</span>
<a name="l00438"></a><a class="code" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394">00438</a> <span class="preprocessor"></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1condition__variable.html#a84c2ec0dd971c593883198a323eeb394" title="Notify one thread that is waiting for the condition.">notify_one</a>()
<a name="l00439"></a>00439 {
<a name="l00440"></a>00440 pthread_cond_signal(&amp;mHandle);
<a name="l00441"></a>00441 }
<a name="l00442"></a>00442 <span class="preprocessor">#endif</span>
<a name="l00443"></a>00443 <span class="preprocessor"></span>
<a name="l00449"></a>00449 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00450"></a>00450 <span class="preprocessor"></span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326" title="Notify all threads that are waiting for the condition.">notify_all</a>();
<a name="l00451"></a>00451 <span class="preprocessor">#else</span>
<a name="l00452"></a><a class="code" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326">00452</a> <span class="preprocessor"></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1condition__variable.html#ad35a04e61229c15c5211ebff00089326" title="Notify all threads that are waiting for the condition.">notify_all</a>()
<a name="l00453"></a>00453 {
<a name="l00454"></a>00454 pthread_cond_broadcast(&amp;mHandle);
<a name="l00455"></a>00455 }
<a name="l00456"></a>00456 <span class="preprocessor">#endif</span>
<a name="l00457"></a>00457 <span class="preprocessor"></span>
<a name="l00458"></a>00458 _TTHREAD_DISABLE_ASSIGNMENT(<a class="code" href="classtthread_1_1condition__variable.html" title="Condition variable class.">condition_variable</a>)
<a name="l00459"></a>00459
<a name="l00460"></a>00460 private:
<a name="l00461"></a>00461 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00462"></a>00462 <span class="preprocessor"></span> <span class="keywordtype">void</span> _wait();
<a name="l00463"></a>00463 HANDLE mEvents[2];
<a name="l00464"></a>00464 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mWaitersCount;
<a name="l00465"></a>00465 CRITICAL_SECTION mWaitersCountLock;
<a name="l00466"></a>00466 <span class="preprocessor">#else</span>
<a name="l00467"></a>00467 <span class="preprocessor"></span> pthread_cond_t mHandle;
<a name="l00468"></a>00468 <span class="preprocessor">#endif</span>
<a name="l00469"></a>00469 <span class="preprocessor"></span>};
<a name="l00470"></a>00470
<a name="l00471"></a>00471
<a name="l00473"></a><a class="code" href="classtthread_1_1thread.html">00473</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1thread.html" title="Thread class.">thread</a> {
<a name="l00474"></a>00474 <span class="keyword">public</span>:
<a name="l00475"></a>00475 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00476"></a>00476 <span class="preprocessor"></span> <span class="keyword">typedef</span> HANDLE native_handle_type;
<a name="l00477"></a>00477 <span class="preprocessor">#else</span>
<a name="l00478"></a>00478 <span class="preprocessor"></span> <span class="keyword">typedef</span> pthread_t native_handle_type;
<a name="l00479"></a>00479 <span class="preprocessor">#endif</span>
<a name="l00480"></a>00480 <span class="preprocessor"></span>
<a name="l00481"></a>00481 <span class="keyword">class </span><a class="code" href="classtthread_1_1thread_1_1id.html" title="Thread ID.">id</a>;
<a name="l00482"></a>00482
<a name="l00486"></a><a class="code" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1">00486</a> <a class="code" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1" title="Default constructor.">thread</a>() : mHandle(0), mNotAThread(true)
<a name="l00487"></a>00487 #if defined(_TTHREAD_WIN32_)
<a name="l00488"></a>00488 , mWin32ThreadID(0)
<a name="l00489"></a>00489 #endif
<a name="l00490"></a>00490 {}
<a name="l00491"></a>00491
<a name="l00500"></a>00500 <a class="code" href="classtthread_1_1thread.html#a1816c2a63c2941090f9a24e5a62efea1" title="Default constructor.">thread</a>(<span class="keywordtype">void</span> (*aFunction)(<span class="keywordtype">void</span> *), <span class="keywordtype">void</span> * aArg);
<a name="l00501"></a>00501
<a name="l00506"></a>00506 <a class="code" href="classtthread_1_1thread.html#a626c04c85c7e2b10215bc4a35062f177" title="Destructor.">~thread</a>();
<a name="l00507"></a>00507
<a name="l00509"></a>00509 <span class="keywordtype">void</span> <a class="code" href="classtthread_1_1thread.html#a6c7abfff648dad193674fc432ad4840d" title="Wait for the thread to finish (join execution flows).">join</a>();
<a name="l00510"></a>00510
<a name="l00513"></a>00513 <span class="keywordtype">bool</span> <a class="code" href="classtthread_1_1thread.html#a5f02386ef3b6ef614321b6ec3606b242" title="Check if the thread is joinable.">joinable</a>() <span class="keyword">const</span>;
<a name="l00514"></a>00514
<a name="l00516"></a>00516 <span class="keywordtype">id</span> <a class="code" href="classtthread_1_1thread.html#afb4f4110b330d27774c16baec4f7d4f5" title="Return the thread ID of a thread object.">get_id</a>() <span class="keyword">const</span>;
<a name="l00517"></a>00517
<a name="l00521"></a><a class="code" href="classtthread_1_1thread.html#ac9ba019ced75a29c52c41aff4e1ca20e">00521</a> <span class="keyword">inline</span> native_handle_type <a class="code" href="classtthread_1_1thread.html#ac9ba019ced75a29c52c41aff4e1ca20e" title="Get the native handle for this thread.">native_handle</a>()
<a name="l00522"></a>00522 {
<a name="l00523"></a>00523 <span class="keywordflow">return</span> mHandle;
<a name="l00524"></a>00524 }
<a name="l00525"></a>00525
<a name="l00531"></a>00531 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="classtthread_1_1thread.html#a3b04fb20012111681e37dfe63f105f6d" title="Determine the number of threads which can possibly execute concurrently.">hardware_concurrency</a>();
<a name="l00532"></a>00532
<a name="l00533"></a>00533 _TTHREAD_DISABLE_ASSIGNMENT(<a class="code" href="classtthread_1_1thread.html" title="Thread class.">thread</a>)
<a name="l00534"></a>00534
<a name="l00535"></a>00535 private:
<a name="l00536"></a>00536 native_handle_type mHandle;
<a name="l00537"></a>00537 mutable <a class="code" href="classtthread_1_1mutex.html" title="Mutex class.">mutex</a> mDataMutex;
<a name="l00538"></a>00538 <span class="keywordtype">bool</span> mNotAThread;
<a name="l00539"></a>00539 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00540"></a>00540 <span class="preprocessor"></span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mWin32ThreadID;
<a name="l00541"></a>00541 <span class="preprocessor">#endif</span>
<a name="l00542"></a>00542 <span class="preprocessor"></span>
<a name="l00543"></a>00543 <span class="comment">// This is the internal thread wrapper function.</span>
<a name="l00544"></a>00544 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00545"></a>00545 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> WINAPI wrapper_function(<span class="keywordtype">void</span> * aArg);
<a name="l00546"></a>00546 <span class="preprocessor">#else</span>
<a name="l00547"></a>00547 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keywordtype">void</span> * wrapper_function(<span class="keywordtype">void</span> * aArg);
<a name="l00548"></a>00548 <span class="preprocessor">#endif</span>
<a name="l00549"></a>00549 <span class="preprocessor"></span>};
<a name="l00550"></a>00550
<a name="l00554"></a><a class="code" href="classtthread_1_1thread_1_1id.html">00554</a> <span class="keyword">class </span><a class="code" href="classtthread_1_1thread_1_1id.html" title="Thread ID.">thread::id</a> {
<a name="l00555"></a>00555 <span class="keyword">public</span>:
<a name="l00559"></a><a class="code" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d">00559</a> <a class="code" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d" title="Default constructor.">id</a>() : mId(0) {};
<a name="l00560"></a>00560
<a name="l00561"></a>00561 <a class="code" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d" title="Default constructor.">id</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> aId) : mId(aId) {};
<a name="l00562"></a>00562
<a name="l00563"></a>00563 <a class="code" href="classtthread_1_1thread_1_1id.html#a087060b582403885d08e89ad894ecc5d" title="Default constructor.">id</a>(<span class="keyword">const</span> <span class="keywordtype">id</span>&amp; aId) : mId(aId.mId) {};
<a name="l00564"></a>00564
<a name="l00565"></a>00565 <span class="keyword">inline</span> <span class="keywordtype">id</span> &amp; operator=(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId)
<a name="l00566"></a>00566 {
<a name="l00567"></a>00567 mId = aId.mId;
<a name="l00568"></a>00568 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00569"></a>00569 }
<a name="l00570"></a>00570
<a name="l00571"></a>00571 <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId1, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId2)
<a name="l00572"></a>00572 {
<a name="l00573"></a>00573 <span class="keywordflow">return</span> (aId1.mId == aId2.mId);
<a name="l00574"></a>00574 }
<a name="l00575"></a>00575
<a name="l00576"></a>00576 <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId1, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId2)
<a name="l00577"></a>00577 {
<a name="l00578"></a>00578 <span class="keywordflow">return</span> (aId1.mId != aId2.mId);
<a name="l00579"></a>00579 }
<a name="l00580"></a>00580
<a name="l00581"></a>00581 <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">bool</span> operator&lt;=(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId1, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId2)
<a name="l00582"></a>00582 {
<a name="l00583"></a>00583 <span class="keywordflow">return</span> (aId1.mId &lt;= aId2.mId);
<a name="l00584"></a>00584 }
<a name="l00585"></a>00585
<a name="l00586"></a>00586 <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">bool</span> operator&lt;(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId1, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId2)
<a name="l00587"></a>00587 {
<a name="l00588"></a>00588 <span class="keywordflow">return</span> (aId1.mId &lt; aId2.mId);
<a name="l00589"></a>00589 }
<a name="l00590"></a>00590
<a name="l00591"></a>00591 <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">bool</span> operator&gt;=(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId1, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId2)
<a name="l00592"></a>00592 {
<a name="l00593"></a>00593 <span class="keywordflow">return</span> (aId1.mId &gt;= aId2.mId);
<a name="l00594"></a>00594 }
<a name="l00595"></a>00595
<a name="l00596"></a>00596 <span class="keyword">inline</span> <span class="keyword">friend</span> <span class="keywordtype">bool</span> operator&gt;(<span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId1, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;aId2)
<a name="l00597"></a>00597 {
<a name="l00598"></a>00598 <span class="keywordflow">return</span> (aId1.mId &gt; aId2.mId);
<a name="l00599"></a>00599 }
<a name="l00600"></a>00600
<a name="l00601"></a>00601 <span class="keyword">inline</span> <span class="keyword">friend</span> std::ostream&amp; operator &lt;&lt;(std::ostream &amp;os, <span class="keyword">const</span> <span class="keywordtype">id</span> &amp;obj)
<a name="l00602"></a>00602 {
<a name="l00603"></a>00603 os &lt;&lt; obj.mId;
<a name="l00604"></a>00604 <span class="keywordflow">return</span> os;
<a name="l00605"></a>00605 }
<a name="l00606"></a>00606
<a name="l00607"></a>00607 <span class="keyword">private</span>:
<a name="l00608"></a>00608 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> mId;
<a name="l00609"></a>00609 };
<a name="l00610"></a>00610
<a name="l00611"></a>00611
<a name="l00612"></a>00612 <span class="comment">// Related to &lt;ratio&gt; - minimal to be able to support chrono.</span>
<a name="l00613"></a>00613 <span class="keyword">typedef</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> __intmax_t;
<a name="l00614"></a>00614
<a name="l00617"></a><a class="code" href="classtthread_1_1ratio.html">00617</a> <span class="keyword">template</span> &lt;__<span class="keywordtype">int</span>max_t N, __<span class="keywordtype">int</span>max_t D = 1&gt; <span class="keyword">class </span><a class="code" href="classtthread_1_1ratio.html" title="Minimal implementation of the ratio class.">ratio</a> {
<a name="l00618"></a>00618 <span class="keyword">public</span>:
<a name="l00619"></a>00619 <span class="keyword">static</span> <span class="keywordtype">double</span> _as_double() { <span class="keywordflow">return</span> double(N) / double(D); }
<a name="l00620"></a>00620 };
<a name="l00621"></a>00621
<a name="l00624"></a><a class="code" href="namespacetthread_1_1chrono.html">00624</a> <span class="keyword">namespace </span>chrono {
<a name="l00627"></a><a class="code" href="classtthread_1_1chrono_1_1duration.html">00627</a> <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Rep, <span class="keyword">class</span> _Period = ratio&lt;1&gt; &gt; <span class="keyword">class </span><a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration</a> {
<a name="l00628"></a>00628 <span class="keyword">private</span>:
<a name="l00629"></a>00629 _Rep rep_;
<a name="l00630"></a>00630 <span class="keyword">public</span>:
<a name="l00631"></a>00631 <span class="keyword">typedef</span> _Rep rep;
<a name="l00632"></a>00632 <span class="keyword">typedef</span> _Period period;
<a name="l00633"></a>00633
<a name="l00635"></a>00635 <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Rep2&gt;
<a name="l00636"></a><a class="code" href="classtthread_1_1chrono_1_1duration.html#a5d86b0d68c98b74e3a6e541c1759ef3e">00636</a> <span class="keyword">explicit</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html#a5d86b0d68c98b74e3a6e541c1759ef3e" title="Construct a duration object with the given duration.">duration</a>(<span class="keyword">const</span> _Rep2&amp; r) : rep_(r) {};
<a name="l00637"></a>00637
<a name="l00639"></a><a class="code" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020">00639</a> rep <a class="code" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020" title="Return the value of the duration object.">count</a>()<span class="keyword"> const</span>
<a name="l00640"></a>00640 <span class="keyword"> </span>{
<a name="l00641"></a>00641 <span class="keywordflow">return</span> rep_;
<a name="l00642"></a>00642 }
<a name="l00643"></a>00643 };
<a name="l00644"></a>00644
<a name="l00645"></a>00645 <span class="comment">// Standard duration types.</span>
<a name="l00646"></a><a class="code" href="namespacetthread_1_1chrono.html#a1396eccd0048d613bae0a745b55fa624">00646</a> <span class="keyword">typedef</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration&lt;__intmax_t, ratio&lt;1, 1000000000&gt;</a> &gt; <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">nanoseconds</a>;
<a name="l00647"></a><a class="code" href="namespacetthread_1_1chrono.html#add152055d7a764f3c1e5af1710f8814f">00647</a> <span class="keyword">typedef</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration&lt;__intmax_t, ratio&lt;1, 1000000&gt;</a> &gt; <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">microseconds</a>;
<a name="l00648"></a><a class="code" href="namespacetthread_1_1chrono.html#a2cf88065d403d0e61022510769380b75">00648</a> <span class="keyword">typedef</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration&lt;__intmax_t, ratio&lt;1, 1000&gt;</a> &gt; <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">milliseconds</a>;
<a name="l00649"></a><a class="code" href="namespacetthread_1_1chrono.html#a302ea2e096592e90ec58ccdcc6ec42c3">00649</a> <span class="keyword">typedef</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration&lt;__intmax_t&gt;</a> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">seconds</a>;
<a name="l00650"></a><a class="code" href="namespacetthread_1_1chrono.html#a2a9e93851a6aee0eb47cc6379287ee16">00650</a> <span class="keyword">typedef</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration&lt;__intmax_t, ratio&lt;60&gt;</a> &gt; <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">minutes</a>;
<a name="l00651"></a><a class="code" href="namespacetthread_1_1chrono.html#af212c337748be0da79f5a3a509f36cdf">00651</a> <span class="keyword">typedef</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">duration&lt;__intmax_t, ratio&lt;3600&gt;</a> &gt; <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">hours</a>;
<a name="l00652"></a>00652 }
<a name="l00653"></a>00653
<a name="l00656"></a><a class="code" href="namespacetthread_1_1this__thread.html">00656</a> <span class="keyword">namespace </span>this_thread {
<a name="l00658"></a>00658 <a class="code" href="classtthread_1_1thread_1_1id.html" title="Thread ID.">thread::id</a> <a class="code" href="namespacetthread_1_1this__thread.html#ab9370620a3920b9ec550f84fb44fb032" title="Return the thread ID of the calling thread.">get_id</a>();
<a name="l00659"></a>00659
<a name="l00663"></a><a class="code" href="namespacetthread_1_1this__thread.html#a867ef7ad1dd6026b7ee13bb013e00edd">00663</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacetthread_1_1this__thread.html#a867ef7ad1dd6026b7ee13bb013e00edd" title="Yield execution to another thread.">yield</a>()
<a name="l00664"></a>00664 {
<a name="l00665"></a>00665 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00666"></a>00666 <span class="preprocessor"></span> Sleep(0);
<a name="l00667"></a>00667 <span class="preprocessor">#else</span>
<a name="l00668"></a>00668 <span class="preprocessor"></span> sched_yield();
<a name="l00669"></a>00669 <span class="preprocessor">#endif</span>
<a name="l00670"></a>00670 <span class="preprocessor"></span> }
<a name="l00671"></a>00671
<a name="l00681"></a><a class="code" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398">00681</a> <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Rep, <span class="keyword">class</span> _Period&gt; <span class="keywordtype">void</span> <a class="code" href="namespacetthread_1_1this__thread.html#acba48c6dbf12d38ab816c18c1ef96398" title="Blocks the calling thread for a period of time.">sleep_for</a>(<span class="keyword">const</span> <a class="code" href="classtthread_1_1chrono_1_1duration.html" title="Duration template class.">chrono::duration&lt;_Rep, _Period&gt;</a>&amp; aTime)
<a name="l00682"></a>00682 {
<a name="l00683"></a>00683 <span class="preprocessor">#if defined(_TTHREAD_WIN32_)</span>
<a name="l00684"></a>00684 <span class="preprocessor"></span> Sleep(<span class="keywordtype">int</span>(<span class="keywordtype">double</span>(aTime.<a class="code" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020" title="Return the value of the duration object.">count</a>()) * (1000.0 * _Period::_as_double()) + 0.5));
<a name="l00685"></a>00685 <span class="preprocessor">#else</span>
<a name="l00686"></a>00686 <span class="preprocessor"></span> usleep(<span class="keywordtype">int</span>(<span class="keywordtype">double</span>(aTime.<a class="code" href="classtthread_1_1chrono_1_1duration.html#a3f01111f479d27be202983aacb03c020" title="Return the value of the duration object.">count</a>()) * (1000000.0 * _Period::_as_double()) + 0.5));
<a name="l00687"></a>00687 <span class="preprocessor">#endif</span>
<a name="l00688"></a>00688 <span class="preprocessor"></span> }
<a name="l00689"></a>00689 }
<a name="l00690"></a>00690
<a name="l00691"></a>00691 }
<a name="l00692"></a>00692
<a name="l00693"></a>00693 <span class="comment">// Define/macro cleanup</span>
<a name="l00694"></a>00694 <span class="preprocessor">#undef _TTHREAD_DISABLE_ASSIGNMENT</span>
<a name="l00695"></a>00695 <span class="preprocessor"></span>
<a name="l00696"></a>00696 <span class="preprocessor">#endif // _TINYTHREAD_H_</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Oct 1 21:49:33 2010 for TinyThread++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>

239
external/TinyThread/source/fast_mutex.h vendored Normal file
View file

@ -0,0 +1,239 @@
/*
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#ifndef _FAST_MUTEX_H_
#define _FAST_MUTEX_H_
/// @file
// Which platform are we on?
#if !defined(_TTHREAD_PLATFORM_DEFINED_)
#if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__)
#define _TTHREAD_WIN32_
#else
#define _TTHREAD_POSIX_
#endif
#define _TTHREAD_PLATFORM_DEFINED_
#endif
// Check if we can support the assembly language level implementation (otherwise
// revert to the system API)
#if (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) || \
(defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || \
(defined(__GNUC__) && (defined(__ppc__)))
#define _FAST_MUTEX_ASM_
#else
#define _FAST_MUTEX_SYS_
#endif
#if defined(_TTHREAD_WIN32_)
#include <windows.h>
#else
#ifdef _FAST_MUTEX_ASM_
#include <sched.h>
#else
#include <pthread.h>
#endif
#endif
namespace tthread {
/// Fast mutex class.
/// This is a mutual exclusion object for synchronizing access to shared
/// memory areas for several threads. It is similar to the tthread::mutex class,
/// but instead of using system level functions, it is implemented as an atomic
/// spin lock with very low CPU overhead.
///
/// The \c fast_mutex class is NOT compatible with the \c condition_variable
/// class (however, it IS compatible with the \c lock_guard class). It should
/// also be noted that the \c fast_mutex class typically does not provide
/// as accurate thread scheduling as a the standard \c mutex class does.
///
/// Because of the limitations of the class, it should only be used in
/// situations where the mutex needs to be locked/unlocked very frequently.
///
/// @note The "fast" version of this class relies on inline assembler language,
/// which is currently only supported for 32/64-bit Intel x86/AMD64 and
/// PowerPC architectures on a limited number of compilers (GNU g++ and MS
/// Visual C++).
/// For other architectures/compilers, system functions are used instead.
class fast_mutex {
public:
/// Constructor.
#if defined(_FAST_MUTEX_ASM_)
fast_mutex() : mLock(0) {}
#else
fast_mutex()
{
#if defined(_TTHREAD_WIN32_)
InitializeCriticalSection(&mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_mutex_init(&mHandle, NULL);
#endif
}
#endif
#if !defined(_FAST_MUTEX_ASM_)
/// Destructor.
~fast_mutex()
{
#if defined(_TTHREAD_WIN32_)
DeleteCriticalSection(&mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_mutex_destroy(&mHandle);
#endif
}
#endif
/// Lock the mutex.
/// The method will block the calling thread until a lock on the mutex can
/// be obtained. The mutex remains locked until \c unlock() is called.
/// @see lock_guard
inline void lock()
{
#if defined(_FAST_MUTEX_ASM_)
bool gotLock;
do {
gotLock = try_lock();
if(!gotLock)
{
#if defined(_TTHREAD_WIN32_)
Sleep(0);
#elif defined(_TTHREAD_POSIX_)
sched_yield();
#endif
}
} while(!gotLock);
#else
#if defined(_TTHREAD_WIN32_)
EnterCriticalSection(&mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_mutex_lock(&mHandle);
#endif
#endif
}
/// Try to lock the mutex.
/// The method will try to lock the mutex. If it fails, the function will
/// return immediately (non-blocking).
/// @return \c true if the lock was acquired, or \c false if the lock could
/// not be acquired.
inline bool try_lock()
{
#if defined(_FAST_MUTEX_ASM_)
int oldLock;
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
asm volatile (
"movl $1,%%eax\n\t"
"xchg %%eax,%0\n\t"
"movl %%eax,%1\n\t"
: "=m" (mLock), "=m" (oldLock)
:
: "%eax", "memory"
);
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
int *ptrLock = &mLock;
__asm {
mov eax,1
mov ecx,ptrLock
xchg eax,[ecx]
mov oldLock,eax
}
#elif defined(__GNUC__) && (defined(__ppc__))
int newLock = 1;
asm volatile (
"\n1:\n\t"
"lwarx %0,0,%1\n\t"
"cmpwi 0,%0,0\n\t"
"bne- 2f\n\t"
"stwcx. %2,0,%1\n\t"
"bne- 1b\n\t"
"isync\n"
"2:\n\t"
: "=&r" (oldLock)
: "r" (&mLock), "r" (newLock)
: "cr0", "memory"
);
#endif
return (oldLock == 0);
#else
#if defined(_TTHREAD_WIN32_)
return TryEnterCriticalSection(&mHandle) ? true : false;
#elif defined(_TTHREAD_POSIX_)
return (pthread_mutex_trylock(&mHandle) == 0) ? true : false;
#endif
#endif
}
/// Unlock the mutex.
/// If any threads are waiting for the lock on this mutex, one of them will
/// be unblocked.
inline void unlock()
{
#if defined(_FAST_MUTEX_ASM_)
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
asm volatile (
"movl $0,%%eax\n\t"
"xchg %%eax,%0\n\t"
: "=m" (mLock)
:
: "%eax", "memory"
);
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
int *ptrLock = &mLock;
__asm {
mov eax,0
mov ecx,ptrLock
xchg eax,[ecx]
}
#elif defined(__GNUC__) && (defined(__ppc__))
asm volatile (
"sync\n\t" // Replace with lwsync where possible?
: : : "memory"
);
mLock = 0;
#endif
#else
#if defined(_TTHREAD_WIN32_)
LeaveCriticalSection(&mHandle);
#elif defined(_TTHREAD_POSIX_)
pthread_mutex_unlock(&mHandle);
#endif
#endif
}
private:
#if defined(_FAST_MUTEX_ASM_)
int mLock;
#else
#if defined(_TTHREAD_WIN32_)
CRITICAL_SECTION mHandle;
#elif defined(_TTHREAD_POSIX_)
pthread_mutex_t mHandle;
#endif
#endif
};
}
#endif // _FAST_MUTEX_H_

View file

@ -0,0 +1,287 @@
/*
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <exception>
#include "tinythread.h"
#if defined(_TTHREAD_POSIX_)
#include <unistd.h>
#include <map>
#elif defined(_TTHREAD_WIN32_)
#include <process.h>
#endif
namespace tthread {
//------------------------------------------------------------------------------
// condition_variable
//------------------------------------------------------------------------------
// NOTE 1: The Win32 implementation of the condition_variable class is based on
// the corresponding implementation in GLFW, which in turn is based on a
// description by Douglas C. Schmidt and Irfan Pyarali:
// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
//
// NOTE 2: Windows Vista actually has native support for condition variables
// (InitializeConditionVariable, WakeConditionVariable, etc), but we want to
// be portable with pre-Vista Windows versions, so TinyThread++ does not use
// Vista condition variables.
//------------------------------------------------------------------------------
#if defined(_TTHREAD_WIN32_)
#define _CONDITION_EVENT_ONE 0
#define _CONDITION_EVENT_ALL 1
#endif
#if defined(_TTHREAD_WIN32_)
condition_variable::condition_variable() : mWaitersCount(0)
{
mEvents[_CONDITION_EVENT_ONE] = CreateEvent(NULL, FALSE, FALSE, NULL);
mEvents[_CONDITION_EVENT_ALL] = CreateEvent(NULL, TRUE, FALSE, NULL);
InitializeCriticalSection(&mWaitersCountLock);
}
#endif
#if defined(_TTHREAD_WIN32_)
condition_variable::~condition_variable()
{
CloseHandle(mEvents[_CONDITION_EVENT_ONE]);
CloseHandle(mEvents[_CONDITION_EVENT_ALL]);
DeleteCriticalSection(&mWaitersCountLock);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::_wait()
{
// Wait for either event to become signaled due to notify_one() or
// notify_all() being called
int result = WaitForMultipleObjects(2, mEvents, FALSE, INFINITE);
// Check if we are the last waiter
EnterCriticalSection(&mWaitersCountLock);
-- mWaitersCount;
bool lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) &&
(mWaitersCount == 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we are the last waiter to be notified to stop waiting, reset the event
if(lastWaiter)
ResetEvent(mEvents[_CONDITION_EVENT_ALL]);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::notify_one()
{
// Are there any waiters?
EnterCriticalSection(&mWaitersCountLock);
bool haveWaiters = (mWaitersCount > 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we have any waiting threads, send them a signal
if(haveWaiters)
SetEvent(mEvents[_CONDITION_EVENT_ONE]);
}
#endif
#if defined(_TTHREAD_WIN32_)
void condition_variable::notify_all()
{
// Are there any waiters?
EnterCriticalSection(&mWaitersCountLock);
bool haveWaiters = (mWaitersCount > 0);
LeaveCriticalSection(&mWaitersCountLock);
// If we have any waiting threads, send them a signal
if(haveWaiters)
SetEvent(mEvents[_CONDITION_EVENT_ALL]);
}
#endif
//------------------------------------------------------------------------------
// POSIX pthread_t to unique thread::id mapping logic.
// Note: Here we use a global thread safe std::map to convert instances of
// pthread_t to small thread identifier numbers (unique within one process).
// This method should be portable across different POSIX implementations.
//------------------------------------------------------------------------------
#if defined(_TTHREAD_POSIX_)
static thread::id _pthread_t_to_ID(const pthread_t &aHandle)
{
static mutex idMapLock;
static std::map<pthread_t, unsigned long int> idMap;
static unsigned long int idCount(1);
lock_guard<mutex> guard(idMapLock);
if(idMap.find(aHandle) == idMap.end())
idMap[aHandle] = idCount ++;
return thread::id(idMap[aHandle]);
}
#endif // _TTHREAD_POSIX_
//------------------------------------------------------------------------------
// thread
//------------------------------------------------------------------------------
/// Information to pass to the new thread (what to run).
struct _thread_start_info {
void (*mFunction)(void *); ///< Pointer to the function to be executed.
void * mArg; ///< Function argument for the thread function.
thread * mThread; ///< Pointer to the thread object.
};
// Thread wrapper function.
#if defined(_TTHREAD_WIN32_)
unsigned WINAPI thread::wrapper_function(void * aArg)
#elif defined(_TTHREAD_POSIX_)
void * thread::wrapper_function(void * aArg)
#endif
{
// Get thread startup information
_thread_start_info * ti = (_thread_start_info *) aArg;
try
{
// Call the actual client thread function
ti->mFunction(ti->mArg);
}
catch(...)
{
// Uncaught exceptions will terminate the application (default behavior
// according to the C++0x draft)
std::terminate();
}
// The thread is no longer executing
lock_guard<mutex> guard(ti->mThread->mDataMutex);
ti->mThread->mNotAThread = true;
// The thread is responsible for freeing the startup information
delete ti;
return 0;
}
thread::thread(void (*aFunction)(void *), void * aArg)
{
// Serialize access to this thread structure
lock_guard<mutex> guard(mDataMutex);
// Fill out the thread startup information (passed to the thread wrapper,
// which will eventually free it)
_thread_start_info * ti = new _thread_start_info;
ti->mFunction = aFunction;
ti->mArg = aArg;
ti->mThread = this;
// The thread is now alive
mNotAThread = false;
// Create the thread
#if defined(_TTHREAD_WIN32_)
mHandle = (HANDLE) _beginthreadex(0, 0, wrapper_function, (void *) ti, 0, &mWin32ThreadID);
#elif defined(_TTHREAD_POSIX_)
if(pthread_create(&mHandle, NULL, wrapper_function, (void *) ti) != 0)
mHandle = 0;
#endif
// Did we fail to create the thread?
if(!mHandle)
{
mNotAThread = true;
delete ti;
}
}
thread::~thread()
{
if(joinable())
std::terminate();
}
void thread::join()
{
if(joinable())
{
#if defined(_TTHREAD_WIN32_)
WaitForSingleObject(mHandle, INFINITE);
#elif defined(_TTHREAD_POSIX_)
pthread_join(mHandle, NULL);
#endif
}
}
bool thread::joinable() const
{
mDataMutex.lock();
bool result = !mNotAThread;
mDataMutex.unlock();
return result;
}
thread::id thread::get_id() const
{
if(!joinable())
return id();
#if defined(_TTHREAD_WIN32_)
return id((unsigned long int) mWin32ThreadID);
#elif defined(_TTHREAD_POSIX_)
return _pthread_t_to_ID(mHandle);
#endif
}
unsigned thread::hardware_concurrency()
{
#if defined(_TTHREAD_WIN32_)
SYSTEM_INFO si;
GetSystemInfo(&si);
return (int) si.dwNumberOfProcessors;
#elif defined(_SC_NPROCESSORS_ONLN)
return (int) sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(_SC_NPROC_ONLN)
return (int) sysconf(_SC_NPROC_ONLN);
#else
// The standard requires this function to return zero if the number of
// hardware cores could not be determined.
return 0;
#endif
}
//------------------------------------------------------------------------------
// this_thread
//------------------------------------------------------------------------------
thread::id this_thread::get_id()
{
#if defined(_TTHREAD_WIN32_)
return thread::id((unsigned long int) GetCurrentThreadId());
#elif defined(_TTHREAD_POSIX_)
return _pthread_t_to_ID(pthread_self());
#endif
}
}

696
external/TinyThread/source/tinythread.h vendored Normal file
View file

@ -0,0 +1,696 @@
/*
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#ifndef _TINYTHREAD_H_
#define _TINYTHREAD_H_
/// @file
/// @mainpage TinyThread++ API Reference
///
/// @section intro_sec Introduction
/// TinyThread++ is a minimal, portable implementation of basic threading
/// classes for C++.
///
/// They closely mimic the functionality and naming of the C++0x standard, and
/// should be easily replaceable with the corresponding std:: variants.
///
/// @section port_sec Portability
/// The Win32 variant uses the native Win32 API for implementing the thread
/// classes, while for other systems, the POSIX threads API (pthread) is used.
///
/// @section class_sec Classes
/// In order to mimic the threading API of the C++0x standard, subsets of
/// several classes are provided. The fundamental classes are:
/// @li tthread::thread
/// @li tthread::mutex
/// @li tthread::recursive_mutex
/// @li tthread::condition_variable
/// @li tthread::lock_guard
/// @li tthread::fast_mutex
///
/// @section misc_sec Miscellaneous
/// The following special keywords are available: #thread_local.
///
/// For more detailed information (including additional classes), browse the
/// different sections of this documentation. A good place to start is:
/// tinythread.h.
// Which platform are we on?
#if !defined(_TTHREAD_PLATFORM_DEFINED_)
#if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__)
#define _TTHREAD_WIN32_
#else
#define _TTHREAD_POSIX_
#endif
#define _TTHREAD_PLATFORM_DEFINED_
#endif
// Platform specific includes
#if defined(_TTHREAD_WIN32_)
#include <windows.h>
#else
#include <pthread.h>
#include <signal.h>
#include <sched.h>
#include <unistd.h>
#endif
// Generic includes
#include <ostream>
/// TinyThread++ version (major number).
#define TINYTHREAD_VERSION_MAJOR 1
/// TinyThread++ version (minor number).
#define TINYTHREAD_VERSION_MINOR 0
/// TinyThread++ version (full version).
#define TINYTHREAD_VERSION (TINYTHREAD_VERSION_MAJOR * 100 + TINYTHREAD_VERSION_MINOR)
// Do we have a fully featured C++0x compiler?
#if (__cplusplus > 199711L) || (defined(__STDCXX_VERSION__) && (__STDCXX_VERSION__ >= 201001L))
#define _TTHREAD_CPP0X_
#endif
// ...at least partial C++0x?
#if defined(_TTHREAD_CPP0X_) || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
#define _TTHREAD_CPP0X_PARTIAL_
#endif
// Macro for disabling assignments of objects.
#ifdef _TTHREAD_CPP0X_PARTIAL_
#define _TTHREAD_DISABLE_ASSIGNMENT(name) \
name(const name&) = delete; \
name& operator=(const name&) = delete;
#else
#define _TTHREAD_DISABLE_ASSIGNMENT(name) \
name(const name&); \
name& operator=(const name&);
#endif
/// @def thread_local
/// Thread local storage keyword.
/// A variable that is declared with the \c thread_local keyword makes the
/// value of the variable local to each thread (known as thread-local storage,
/// or TLS). Example usage:
/// @code
/// // This variable is local to each thread.
/// thread_local int variable;
/// @endcode
/// @note The \c thread_local keyword is a macro that maps to the corresponding
/// compiler directive (e.g. \c __declspec(thread)). While the C++0x standard
/// allows for non-trivial types (e.g. classes with constructors and
/// destructors) to be declared with the \c thread_local keyword, most pre-C++0x
/// compilers only allow for trivial types (e.g. \c int). So, to guarantee
/// portable code, only use trivial types for thread local storage.
/// @note This directive is currently not supported on Mac OS X (it will give
/// a compiler error), since compile-time TLS is not supported in the Mac OS X
/// executable format. Also, some older versions of MinGW (before GCC 4.x) do
/// not support this directive.
/// @hideinitializer
#if !defined(_TTHREAD_CPP0X_) && !defined(thread_local)
#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
#define thread_local __thread
#else
#define thread_local __declspec(thread)
#endif
#endif
/// Main name space for TinyThread++.
/// This namespace is more or less equivalent to the \c std namespace for the
/// C++0x thread classes. For instance, the tthread::mutex class corresponds to
/// the std::mutex class.
namespace tthread {
/// Mutex class.
/// This is a mutual exclusion object for synchronizing access to shared
/// memory areas for several threads. The mutex is non-recursive (i.e. a
/// program may deadlock if the thread that owns a mutex object calls lock()
/// on that object).
/// @see recursive_mutex
class mutex {
public:
/// Constructor.
mutex()
#if defined(_TTHREAD_WIN32_)
: mAlreadyLocked(false)
#endif
{
#if defined(_TTHREAD_WIN32_)
InitializeCriticalSection(&mHandle);
#else
pthread_mutex_init(&mHandle, NULL);
#endif
}
/// Destructor.
~mutex()
{
#if defined(_TTHREAD_WIN32_)
DeleteCriticalSection(&mHandle);
#else
pthread_mutex_destroy(&mHandle);
#endif
}
/// Lock the mutex.
/// The method will block the calling thread until a lock on the mutex can
/// be obtained. The mutex remains locked until \c unlock() is called.
/// @see lock_guard
inline void lock()
{
#if defined(_TTHREAD_WIN32_)
EnterCriticalSection(&mHandle);
while(mAlreadyLocked) Sleep(1000); // Simulate deadlock...
mAlreadyLocked = true;
#else
pthread_mutex_lock(&mHandle);
#endif
}
/// Try to lock the mutex.
/// The method will try to lock the mutex. If it fails, the function will
/// return immediately (non-blocking).
/// @return \c true if the lock was acquired, or \c false if the lock could
/// not be acquired.
inline bool try_lock()
{
#if defined(_TTHREAD_WIN32_)
bool ret = (TryEnterCriticalSection(&mHandle) ? true : false);
if(ret && mAlreadyLocked)
{
LeaveCriticalSection(&mHandle);
ret = false;
}
return ret;
#else
return (pthread_mutex_trylock(&mHandle) == 0) ? true : false;
#endif
}
/// Unlock the mutex.
/// If any threads are waiting for the lock on this mutex, one of them will
/// be unblocked.
inline void unlock()
{
#if defined(_TTHREAD_WIN32_)
mAlreadyLocked = false;
LeaveCriticalSection(&mHandle);
#else
pthread_mutex_unlock(&mHandle);
#endif
}
_TTHREAD_DISABLE_ASSIGNMENT(mutex)
private:
#if defined(_TTHREAD_WIN32_)
CRITICAL_SECTION mHandle;
bool mAlreadyLocked;
#else
pthread_mutex_t mHandle;
#endif
friend class condition_variable;
};
/// Recursive mutex class.
/// This is a mutual exclusion object for synchronizing access to shared
/// memory areas for several threads. The mutex is recursive (i.e. a thread
/// may lock the mutex several times, as long as it unlocks the mutex the same
/// number of times).
/// @see mutex
class recursive_mutex {
public:
/// Constructor.
recursive_mutex()
{
#if defined(_TTHREAD_WIN32_)
InitializeCriticalSection(&mHandle);
#else
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&mHandle, &attr);
#endif
}
/// Destructor.
~recursive_mutex()
{
#if defined(_TTHREAD_WIN32_)
DeleteCriticalSection(&mHandle);
#else
pthread_mutex_destroy(&mHandle);
#endif
}
/// Lock the mutex.
/// The method will block the calling thread until a lock on the mutex can
/// be obtained. The mutex remains locked until \c unlock() is called.
/// @see lock_guard
inline void lock()
{
#if defined(_TTHREAD_WIN32_)
EnterCriticalSection(&mHandle);
#else
pthread_mutex_lock(&mHandle);
#endif
}
/// Try to lock the mutex.
/// The method will try to lock the mutex. If it fails, the function will
/// return immediately (non-blocking).
/// @return \c true if the lock was acquired, or \c false if the lock could
/// not be acquired.
inline bool try_lock()
{
#if defined(_TTHREAD_WIN32_)
return TryEnterCriticalSection(&mHandle) ? true : false;
#else
return (pthread_mutex_trylock(&mHandle) == 0) ? true : false;
#endif
}
/// Unlock the mutex.
/// If any threads are waiting for the lock on this mutex, one of them will
/// be unblocked.
inline void unlock()
{
#if defined(_TTHREAD_WIN32_)
LeaveCriticalSection(&mHandle);
#else
pthread_mutex_unlock(&mHandle);
#endif
}
_TTHREAD_DISABLE_ASSIGNMENT(recursive_mutex)
private:
#if defined(_TTHREAD_WIN32_)
CRITICAL_SECTION mHandle;
#else
pthread_mutex_t mHandle;
#endif
friend class condition_variable;
};
/// Lock guard class.
/// The constructor locks the mutex, and the destructor unlocks the mutex, so
/// the mutex will automatically be unlocked when the lock guard goes out of
/// scope. Example usage:
/// @code
/// mutex m;
/// int counter;
///
/// void increment()
/// {
/// lock_guard<mutex> guard(m);
/// ++ counter;
/// }
/// @endcode
template <class T>
class lock_guard {
public:
typedef T mutex_type;
lock_guard() : mMutex(0) {}
/// The constructor locks the mutex.
explicit lock_guard(mutex_type &aMutex)
{
mMutex = &aMutex;
mMutex->lock();
}
/// The destructor unlocks the mutex.
~lock_guard()
{
if(mMutex)
mMutex->unlock();
}
private:
mutex_type * mMutex;
};
/// Condition variable class.
/// This is a signalling object for synchronizing the execution flow for
/// several threads. Example usage:
/// @code
/// // Shared data and associated mutex and condition variable objects
/// int count;
/// mutex m;
/// condition_variable cond;
///
/// // Wait for the counter to reach a certain number
/// void wait_counter(int targetCount)
/// {
/// lock_guard<mutex> guard(m);
/// while(count < targetCount)
/// cond.wait(m);
/// }
///
/// // Increment the counter, and notify waiting threads
/// void increment()
/// {
/// lock_guard<mutex> guard(m);
/// ++ count;
/// cond.notify_all();
/// }
/// @endcode
class condition_variable {
public:
/// Constructor.
#if defined(_TTHREAD_WIN32_)
condition_variable();
#else
condition_variable()
{
pthread_cond_init(&mHandle, NULL);
}
#endif
/// Destructor.
#if defined(_TTHREAD_WIN32_)
~condition_variable();
#else
~condition_variable()
{
pthread_cond_destroy(&mHandle);
}
#endif
/// Wait for the condition.
/// The function will block the calling thread until the condition variable
/// is woken by \c notify_one(), \c notify_all() or a spurious wake up.
/// @param[in] aMutex A mutex that will be unlocked when the wait operation
/// starts, an locked again as soon as the wait operation is finished.
template <class _mutexT>
inline void wait(_mutexT &aMutex)
{
#if defined(_TTHREAD_WIN32_)
// Increment number of waiters
EnterCriticalSection(&mWaitersCountLock);
++ mWaitersCount;
LeaveCriticalSection(&mWaitersCountLock);
// Release the mutex while waiting for the condition (will decrease
// the number of waiters when done)...
aMutex.unlock();
_wait();
aMutex.lock();
#else
pthread_cond_wait(&mHandle, &aMutex.mHandle);
#endif
}
/// Notify one thread that is waiting for the condition.
/// If at least one thread is blocked waiting for this condition variable,
/// one will be woken up.
/// @note Only threads that started waiting prior to this call will be
/// woken up.
#if defined(_TTHREAD_WIN32_)
void notify_one();
#else
inline void notify_one()
{
pthread_cond_signal(&mHandle);
}
#endif
/// Notify all threads that are waiting for the condition.
/// All threads that are blocked waiting for this condition variable will
/// be woken up.
/// @note Only threads that started waiting prior to this call will be
/// woken up.
#if defined(_TTHREAD_WIN32_)
void notify_all();
#else
inline void notify_all()
{
pthread_cond_broadcast(&mHandle);
}
#endif
_TTHREAD_DISABLE_ASSIGNMENT(condition_variable)
private:
#if defined(_TTHREAD_WIN32_)
void _wait();
HANDLE mEvents[2]; ///< Signal and broadcast event HANDLEs.
unsigned int mWaitersCount; ///< Count of the number of waiters.
CRITICAL_SECTION mWaitersCountLock; ///< Serialize access to mWaitersCount.
#else
pthread_cond_t mHandle;
#endif
};
/// Thread class.
class thread {
public:
#if defined(_TTHREAD_WIN32_)
typedef HANDLE native_handle_type;
#else
typedef pthread_t native_handle_type;
#endif
class id;
/// Default constructor.
/// Construct a \c thread object without an associated thread of execution
/// (i.e. non-joinable).
thread() : mHandle(0), mNotAThread(true)
#if defined(_TTHREAD_WIN32_)
, mWin32ThreadID(0)
#endif
{}
/// Thread starting constructor.
/// Construct a \c thread object with a new thread of execution.
/// @param[in] aFunction A function pointer to a function of type:
/// <tt>void fun(void * arg)</tt>
/// @param[in] aArg Argument to the thread function.
/// @note This constructor is not fully compatible with the standard C++
/// thread class. It is more similar to the pthread_create() (POSIX) and
/// CreateThread() (Windows) functions.
thread(void (*aFunction)(void *), void * aArg);
/// Destructor.
/// @note If the thread is joinable upon destruction, \c std::terminate()
/// will be called, which terminates the process. It is always wise to do
/// \c join() before deleting a thread object.
~thread();
/// Wait for the thread to finish (join execution flows).
void join();
/// Check if the thread is joinable.
/// A thread object is joinable if it has an associated thread of execution.
bool joinable() const;
/// Return the thread ID of a thread object.
id get_id() const;
/// Get the native handle for this thread.
/// @note Under Windows, this is a \c HANDLE, and under POSIX systems, this
/// is a \c pthread_t.
inline native_handle_type native_handle()
{
return mHandle;
}
/// Determine the number of threads which can possibly execute concurrently.
/// This function is useful for determining the optimal number of threads to
/// use for a task.
/// @return The number of hardware thread contexts in the system.
/// @note If this value is not defined, the function returns zero (0).
static unsigned hardware_concurrency();
_TTHREAD_DISABLE_ASSIGNMENT(thread)
private:
native_handle_type mHandle; ///< Thread handle.
mutable mutex mDataMutex; ///< Serializer for access to the thread private data.
bool mNotAThread; ///< True if this object is not a thread of execution.
#if defined(_TTHREAD_WIN32_)
unsigned int mWin32ThreadID; ///< Unique thread ID (filled out by _beginthreadex).
#endif
// This is the internal thread wrapper function.
#if defined(_TTHREAD_WIN32_)
static unsigned WINAPI wrapper_function(void * aArg);
#else
static void * wrapper_function(void * aArg);
#endif
};
/// Thread ID.
/// The thread ID is a unique identifier for each thread.
/// @see thread::get_id()
class thread::id {
public:
/// Default constructor.
/// The default constructed ID is that of thread without a thread of
/// execution.
id() : mId(0) {};
id(unsigned long int aId) : mId(aId) {};
id(const id& aId) : mId(aId.mId) {};
inline id & operator=(const id &aId)
{
mId = aId.mId;
return *this;
}
inline friend bool operator==(const id &aId1, const id &aId2)
{
return (aId1.mId == aId2.mId);
}
inline friend bool operator!=(const id &aId1, const id &aId2)
{
return (aId1.mId != aId2.mId);
}
inline friend bool operator<=(const id &aId1, const id &aId2)
{
return (aId1.mId <= aId2.mId);
}
inline friend bool operator<(const id &aId1, const id &aId2)
{
return (aId1.mId < aId2.mId);
}
inline friend bool operator>=(const id &aId1, const id &aId2)
{
return (aId1.mId >= aId2.mId);
}
inline friend bool operator>(const id &aId1, const id &aId2)
{
return (aId1.mId > aId2.mId);
}
inline friend std::ostream& operator <<(std::ostream &os, const id &obj)
{
os << obj.mId;
return os;
}
private:
unsigned long int mId;
};
// Related to <ratio> - minimal to be able to support chrono.
typedef long long __intmax_t;
/// Minimal implementation of the \c ratio class. This class provides enough
/// functionality to implement some basic \c chrono classes.
template <__intmax_t N, __intmax_t D = 1> class ratio {
public:
static double _as_double() { return double(N) / double(D); }
};
/// Minimal implementation of the \c chrono namespace.
/// The \c chrono namespace provides types for specifying time intervals.
namespace chrono {
/// Duration template class. This class provides enough functionality to
/// implement \c this_thread::sleep_for().
template <class _Rep, class _Period = ratio<1> > class duration {
private:
_Rep rep_;
public:
typedef _Rep rep;
typedef _Period period;
/// Construct a duration object with the given duration.
template <class _Rep2>
explicit duration(const _Rep2& r) : rep_(r) {};
/// Return the value of the duration object.
rep count() const
{
return rep_;
}
};
// Standard duration types.
typedef duration<__intmax_t, ratio<1, 1000000000> > nanoseconds; ///< Duration with the unit nanoseconds.
typedef duration<__intmax_t, ratio<1, 1000000> > microseconds; ///< Duration with the unit microseconds.
typedef duration<__intmax_t, ratio<1, 1000> > milliseconds; ///< Duration with the unit milliseconds.
typedef duration<__intmax_t> seconds; ///< Duration with the unit seconds.
typedef duration<__intmax_t, ratio<60> > minutes; ///< Duration with the unit minutes.
typedef duration<__intmax_t, ratio<3600> > hours; ///< Duration with the unit hours.
}
/// The namespace \c this_thread provides methods for dealing with the
/// calling thread.
namespace this_thread {
/// Return the thread ID of the calling thread.
thread::id get_id();
/// Yield execution to another thread.
/// Offers the operating system the opportunity to schedule another thread
/// that is ready to run on the current processor.
inline void yield()
{
#if defined(_TTHREAD_WIN32_)
Sleep(0);
#else
sched_yield();
#endif
}
/// Blocks the calling thread for a period of time.
/// @param[in] aTime Minimum time to put the thread to sleep.
/// Example usage:
/// @code
/// // Sleep for 100 milliseconds
/// this_thread::sleep_for(chrono::milliseconds(100));
/// @endcode
/// @note Supported duration types are: nanoseconds, microseconds,
/// milliseconds, seconds, minutes and hours.
template <class _Rep, class _Period> void sleep_for(const chrono::duration<_Rep, _Period>& aTime)
{
#if defined(_TTHREAD_WIN32_)
Sleep(int(double(aTime.count()) * (1000.0 * _Period::_as_double()) + 0.5));
#else
usleep(int(double(aTime.count()) * (1000000.0 * _Period::_as_double()) + 0.5));
#endif
}
}
}
// Define/macro cleanup
#undef _TTHREAD_DISABLE_ASSIGNMENT
#endif // _TINYTHREAD_H_

100
external/TinyThread/test/Makefile vendored Normal file
View file

@ -0,0 +1,100 @@
#-----------------------------------------------------------------------------------------
# Makefile for GCC & gmake (Linux, Windows/MinGW, OpenSolaris, etc).
#-----------------------------------------------------------------------------------------
# Copyright (c) 2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
#-----------------------------------------------------------------------------------------
# A simple hack to check if we are on Windows or not (i.e. are we using mingw32-make?)
ifeq ($(findstring mingw32, $(MAKE)), mingw32)
WINDOWS=1
endif
# Compiler settings
CPP = g++
CPPFLAGS = -W -O3 -c -I../source
LFLAGS =
LIBS =
# Non-windows systems need pthread
ifndef WINDOWS
LIBS += -lpthread
endif
# MinGW32 GCC 4.5 link problem fix
ifdef WINDOWS
ifeq ($(findstring 4.5.,$(shell g++ -dumpversion)), 4.5.)
LFLAGS += -static-libstdc++ -static-libgcc
endif
endif
# Misc. system commands
ifdef WINDOWS
RM = del /Q
else
RM = rm -f
endif
# File endings
ifdef WINDOWS
EXE = .exe
else
EXE =
endif
# Object files for the hello program
HELLO_OBJS = hello.o
# Object files for the test program
TEST_OBJS = test.o
# Object files for the hello program
FRACAL_OBJS = fractal.o
# TinyThread++ object files
TINYTHREAD_OBJS = tinythread.o
all: hello$(EXE) test$(EXE) fractal$(EXE)
clean:
$(RM) hello$(EXE) test$(EXE) fractal$(EXE) $(HELLO_OBJS) $(TEST_OBJS) $(FRACAL_OBJS) $(TINYTHREAD_OBJS)
test$(EXE): $(TEST_OBJS) $(TINYTHREAD_OBJS)
$(CPP) $(LFLAGS) -o $@ $(TEST_OBJS) $(TINYTHREAD_OBJS) $(LIBS)
hello$(EXE): $(HELLO_OBJS) $(TINYTHREAD_OBJS)
$(CPP) $(LFLAGS) -o $@ $(HELLO_OBJS) $(TINYTHREAD_OBJS) $(LIBS)
fractal$(EXE): $(FRACAL_OBJS) $(TINYTHREAD_OBJS)
$(CPP) $(LFLAGS) -o $@ $(FRACAL_OBJS) $(TINYTHREAD_OBJS) $(LIBS)
%.o: %.cpp
$(CPP) $(CPPFLAGS) $<
%.o: ../source/%.cpp
$(CPP) $(CPPFLAGS) $<
# Dependencies
hello.o: hello.cpp ../source/tinythread.h
test.o: test.cpp ../source/tinythread.h ../source/fast_mutex.h
fractal.o: fractal.cpp ../source/tinythread.h
tinythread.o: ../source/tinythread.cpp ../source/tinythread.h

77
external/TinyThread/test/Makefile.msvc vendored Normal file
View file

@ -0,0 +1,77 @@
#-----------------------------------------------------------------------------------------
# Makefile for Microsoft Visual Studio C++
# Usage: nmake /f Makefile.msvc
#-----------------------------------------------------------------------------------------
# Copyright (c) 2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
#-----------------------------------------------------------------------------------------
# Compiler settings
CPP = cl
CPPFLAGS = /nologo /W2 /O2 /c /I../source /EHsc
LFLAGS = /nologo /EHsc
LIBS =
# Misc. system commands
RM = del /Q
# File endings
EXE = .exe
# Object files for the hello program
HELLO_OBJS = hello.obj
# Object files for the test program
TEST_OBJS = test.obj
# Object files for the hello program
FRACAL_OBJS = fractal.obj
# TinyThread++ object files
TINYTHREAD_OBJS = tinythread.obj
all: hello$(EXE) test$(EXE) fractal$(EXE)
clean:
$(RM) hello$(EXE) test$(EXE) fractal$(EXE) $(HELLO_OBJS) $(TEST_OBJS) $(FRACAL_OBJS) $(TINYTHREAD_OBJS)
test$(EXE): $(TEST_OBJS) $(TINYTHREAD_OBJS)
$(CPP) $(LFLAGS) /Fe$@ $(TEST_OBJS) $(TINYTHREAD_OBJS) $(LIBS)
hello$(EXE): $(HELLO_OBJS) $(TINYTHREAD_OBJS)
$(CPP) $(LFLAGS) /Fe$@ $(HELLO_OBJS) $(TINYTHREAD_OBJS) $(LIBS)
fractal$(EXE): $(FRACAL_OBJS) $(TINYTHREAD_OBJS)
$(CPP) $(LFLAGS) /Fe$@ $(FRACAL_OBJS) $(TINYTHREAD_OBJS) $(LIBS)
# Dependencies
hello.obj: hello.cpp ../source/tinythread.h
$(CPP) $(CPPFLAGS) hello.cpp
test.obj: test.cpp ../source/tinythread.h ../source/fast_mutex.h
$(CPP) $(CPPFLAGS) test.cpp
fractal.obj: fractal.cpp ../source/tinythread.h
$(CPP) $(CPPFLAGS) fractal.cpp
tinythread.obj: ../source/tinythread.cpp ../source/tinythread.h
$(CPP) $(CPPFLAGS) ../source/tinythread.cpp

261
external/TinyThread/test/fractal.cpp vendored Normal file
View file

@ -0,0 +1,261 @@
/*
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <string>
#include <list>
#include <cmath>
#include <tinythread.h>
using namespace std;
using namespace tthread;
// Mandelbrot fractal settings
#define MAND_MID_RE -0.69795
#define MAND_MID_IM -0.34865
#define MAND_SIZE 0.003
#define MAND_MAX_ITER 4000
#define MAND_RESOLUTION 1024
/// BGR pixel class.
class Pixel {
public:
Pixel() : r(0), g(0), b(0) {}
Pixel(unsigned char red, unsigned char green, unsigned char blue)
{
r = red;
g = green;
b = blue;
}
unsigned char b, g, r;
};
/// Simple 2D BGR image class.
class Image {
public:
/// Create a new image with the dimensions aWidth x aHeight.
Image(int aWidth, int aHeight)
{
mData = new Pixel[aWidth * aHeight];
mWidth = aWidth;
mHeight = aHeight;
}
~Image()
{
delete mData;
}
/// Write the image to a TGA file.
void WriteToTGAFile(const char * aFileName)
{
// Prepare TGA file header
unsigned char header[18] = {0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0};
header[12] = mWidth & 255; // Image width (16 bits)
header[13] = (mWidth >> 8) & 255; // -"-
header[14] = mHeight & 255; // Image width (16 bits)
header[15] = (mHeight >> 8) & 255; // -"-
// Write output file
ofstream f(aFileName, ios_base::out | ios_base::binary);
f.write((const char *) header, 18);
f.write((const char *) mData, (mWidth * mHeight) * 3);
}
Pixel& operator[](const int idx)
{
return mData[idx];
}
inline int Width() const
{
return mWidth;
}
inline int Height() const
{
return mHeight;
}
private:
int mWidth; ///< Image width.
int mHeight; ///< Image height.
Pixel * mData; ///< Data pointer.
};
/// The RowDispatcher class manages the "job pool" for the fractal
/// calculation threads.
class RowDispatcher {
public:
RowDispatcher(Image * aImage) : mNextRow(0)
{
mImage = aImage;
}
Image * GetImage()
{
return mImage;
}
int NextRow()
{
lock_guard<mutex> guard(mMutex);
if(mNextRow >= mImage->Height())
return -1;
int result = mNextRow;
++ mNextRow;
return result;
}
private:
mutex mMutex;
int mNextRow;
Image * mImage;
};
// Core iteration function
Pixel Iterate(const double &cre, const double &cim, int aIterMax)
{
double zre = 0.0;
double zim = 0.0;
int n = 0;
double absZSqr = 0.0;
while((absZSqr < 4.0) && (n < aIterMax))
{
double tmp = zre * zre - zim * zim + cre;
zim = 2.0 * zre * zim + cim;
zre = tmp;
absZSqr = zre * zre + zim * zim;
++ n;
}
if(n >= aIterMax)
return Pixel(0,0,0);
else
{
double nSmooth = n + 1 - log(log(sqrt(absZSqr))) / log(2.0);
return Pixel(
(unsigned char)(128.0 - 127.0 * cos(0.02 * nSmooth + 0.3)),
(unsigned char)(128.0 - 127.0 * cos(0.016 * nSmooth + 1.2)),
(unsigned char)(128.0 - 127.0 * cos(0.013 * nSmooth + 2.6))
);
}
}
// Calculation thread
void CalcThread(void * arg)
{
RowDispatcher * dispatcher = (RowDispatcher *) arg;
Image * img = dispatcher->GetImage();
// Set min/max interval for the fractal set
double xMin = MAND_MID_RE - MAND_SIZE * 0.5;
double yMin = MAND_MID_IM - MAND_SIZE * 0.5;
double xMax = MAND_MID_RE + MAND_SIZE * 0.5;
double yMax = MAND_MID_IM + MAND_SIZE * 0.5;
// Set step size (distance between two adjacent pixels)
double xStep = (xMax - xMin) / img->Width();
double yStep = (yMax - yMin) / img->Height();
// Until no more rows to process...
while(true)
{
// Get the next row to calculate
int y = dispatcher->NextRow();
// Done?
if(y < 0)
break;
// Generate one row of the image
Pixel * line = &(*img)[y * img->Width()];
double cim = y * yStep + yMin;
double cre = xMin;
for(int x = 0; x < img->Width(); ++ x)
{
*line ++ = Iterate(cre, cim, MAND_MAX_ITER);
cre += xStep;
}
}
}
int main(int argc, char **argv)
{
// Show some information about this program...
cout << "This is a small multi threaded Mandelbrot fractal generator." << endl;
cout << endl;
cout << "The program will generate a " << MAND_RESOLUTION << "x" << MAND_RESOLUTION << " image, using one calculation thread per" << endl;
cout << "processor core. The result is written to a TGA format image, \"fractal.tga\"." << endl;
cout << endl;
cout << "Type \"" << argv[0] << " -st\" to force single threaded operation." << endl;
cout << endl;
// Check arguments
bool singleThreaded = false;
if((argc >= 2) && (string(argv[1]) == string("-st")))
singleThreaded = true;
// Init image and row dispatcher
Image img(MAND_RESOLUTION, MAND_RESOLUTION);
RowDispatcher dispatcher(&img);
// Determine the number of calculation threads to use
int numThreads;
if(!singleThreaded)
{
numThreads = thread::hardware_concurrency();
if(numThreads < 1)
numThreads = 1;
}
else
numThreads = 1;
// Start calculation threads (we run one thread on each processor core)
cout << "Running " << numThreads << " calculation thread(s)..." << flush;
list<thread *> threadList;
for(int i = 0; i < numThreads; ++ i)
{
thread * t = new thread(CalcThread, (void *) &dispatcher);
threadList.push_back(t);
}
// Wait for the threads to complete...
for(list<thread *>::iterator i = threadList.begin(); i != threadList.end(); ++ i)
{
thread * t = *i;
t->join();
delete t;
}
cout << "done!" << endl;
// Write the final image to a file
cout << "Writing final image..." << flush;
img.WriteToTGAFile("fractal.tga");
cout << "done!" << endl;
}

45
external/TinyThread/test/hello.cpp vendored Normal file
View file

@ -0,0 +1,45 @@
/*
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <iostream>
#include <tinythread.h>
using namespace std;
using namespace tthread;
// This is the child thread function
void HelloThread(void * aArg)
{
cout << "Hello world!" << endl;
}
// This is the main program (i.e. the main thread)
int main()
{
// Start the child thread
thread t(HelloThread, 0);
// Wait for the thread to finish
t.join();
}

271
external/TinyThread/test/test.cpp vendored Normal file
View file

@ -0,0 +1,271 @@
/*
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <iostream>
#include <list>
#include <tinythread.h>
#include <fast_mutex.h>
using namespace std;
using namespace tthread;
// HACK: Mac OS X and early MinGW do not support thread-local storage
#if defined(__APPLE__) || (defined(__MINGW32__) && (__GNUC__ < 4))
#define NO_TLS
#endif
// Thread local storage variable
#ifndef NO_TLS
thread_local int gLocalVar;
#endif
// Mutex + global count variable
mutex gMutex;
fast_mutex gFastMutex;
int gCount;
// Condition variable
condition_variable gCond;
// Thread function: Thread ID
void ThreadIDs(void * aArg)
{
cout << " My thread id is " << this_thread::get_id() << "." << endl;
}
#ifndef NO_TLS
// Thread function: Thread-local storage
void ThreadTLS(void * aArg)
{
gLocalVar = 2;
cout << " My gLocalVar is " << gLocalVar << "." << endl;
}
#endif
// Thread function: Mutex locking
void ThreadLock(void * aArg)
{
for(int i = 0; i < 10000; ++ i)
{
lock_guard<mutex> lock(gMutex);
++ gCount;
}
}
// Thread function: Mutex locking
void ThreadLock2(void * aArg)
{
for(int i = 0; i < 10000; ++ i)
{
lock_guard<fast_mutex> lock(gFastMutex);
++ gCount;
}
}
// Thread function: Condition notifier
void ThreadCondition1(void * aArg)
{
lock_guard<mutex> lock(gMutex);
-- gCount;
gCond.notify_all();
}
// Thread function: Condition waiter
void ThreadCondition2(void * aArg)
{
cout << " Wating..." << flush;
lock_guard<mutex> lock(gMutex);
while(gCount > 0)
{
cout << "." << flush;
gCond.wait(gMutex);
}
cout << "." << endl;
}
// Thread function: Yield
void ThreadYield(void * aArg)
{
// Yield...
this_thread::yield();
}
// This is the main program (i.e. the main thread)
int main()
{
// Test 1: Show number of CPU cores in the system
cout << "PART I: Info" << endl;
cout << " Number of processor cores: " << thread::hardware_concurrency() << endl;
// Test 2: thread IDs
cout << endl << "PART II: Thread IDs" << endl;
{
// Show the main thread ID
cout << " Main thread id is " << this_thread::get_id() << "." << endl;
// Start a bunch of child threads - only run a single thread at a time
thread t1(ThreadIDs, 0);
t1.join();
thread t2(ThreadIDs, 0);
t2.join();
thread t3(ThreadIDs, 0);
t3.join();
thread t4(ThreadIDs, 0);
t4.join();
}
// Test 3: thread local storage
cout << endl << "PART III: Thread local storage" << endl;
#ifndef NO_TLS
{
// Clear the TLS variable (it should keep this value after all threads are
// finished).
gLocalVar = 1;
cout << " Main gLocalVar is " << gLocalVar << "." << endl;
// Start a child thread that modifies gLocalVar
thread t1(ThreadTLS, 0);
t1.join();
// Check if the TLS variable has changed
if(gLocalVar == 1)
cout << " Main gLocalID was not changed by the child thread - OK!" << endl;
else
cout << " Main gLocalID was changed by the child thread - FAIL!" << endl;
}
#else
cout << " TLS is not supported on this platform..." << endl;
#endif
// Test 4: mutex locking
cout << endl << "PART IV: Mutex locking (100 threads x 10000 iterations)" << endl;
{
// Clear the global counter.
gCount = 0;
// Start a bunch of child threads
list<thread *> threadList;
for(int i = 0; i < 100; ++ i)
threadList.push_back(new thread(ThreadLock, 0));
// Wait for the threads to finish
list<thread *>::iterator it;
for(it = threadList.begin(); it != threadList.end(); ++ it)
{
thread * t = *it;
t->join();
delete t;
}
// Check the global count
cout << " gCount = " << gCount << endl;
}
// Test 5: fast_mutex locking
cout << endl << "PART V: Fast mutex locking (100 threads x 10000 iterations)" << endl;
{
// Clear the global counter.
gCount = 0;
// Start a bunch of child threads
list<thread *> threadList;
for(int i = 0; i < 100; ++ i)
threadList.push_back(new thread(ThreadLock2, 0));
// Wait for the threads to finish
list<thread *>::iterator it;
for(it = threadList.begin(); it != threadList.end(); ++ it)
{
thread * t = *it;
t->join();
delete t;
}
// Check the global count
cout << " gCount = " << gCount << endl;
}
// Test 6: condition variable
cout << endl << "PART VI: Condition variable (40 + 1 threads)" << endl;
{
// Set the global counter to the number of threads to run.
gCount = 40;
// Start the waiting thread (it will wait for gCount to reach zero).
thread t1(ThreadCondition2, 0);
// Start a bunch of child threads (these will decrease gCount by 1 when they
// finish)
list<thread *> threadList;
for(int i = 0; i < 40; ++ i)
threadList.push_back(new thread(ThreadCondition1, 0));
// Wait for the waiting thread to finish
t1.join();
// Wait for the other threads to finish
list<thread *>::iterator it;
for(it = threadList.begin(); it != threadList.end(); ++ it)
{
thread * t = *it;
t->join();
delete t;
}
}
// Test 7: yield
cout << endl << "PART VII: Yield (40 + 1 threads)" << endl;
{
// Start a bunch of child threads
list<thread *> threadList;
for(int i = 0; i < 40; ++ i)
threadList.push_back(new thread(ThreadYield, 0));
// Yield...
this_thread::yield();
// Wait for the threads to finish
list<thread *>::iterator it;
for(it = threadList.begin(); it != threadList.end(); ++ it)
{
thread * t = *it;
t->join();
delete t;
}
}
// Test 8: sleep
cout << endl << "PART VIII: Sleep (10 x 100 ms)" << endl;
{
// Sleep...
cout << " Sleeping" << flush;
for(int i = 0; i < 10; ++ i)
{
this_thread::sleep_for(chrono::milliseconds(100));
cout << "." << flush;
}
cout << endl;
}
}

View file

@ -1,7 +1,6 @@
add_subdirectory(tests)
find_package(Boost REQUIRED)
find_package(Threads REQUIRED)
add_definitions(-DTIXML_USE_STL)
@ -35,9 +34,9 @@ target_link_libraries(updatershared
anyoption
tinyxml
minizip
tinythread
# TODO - Mac and Windows version
pthread
/usr/lib/libboost_thread.a
)
add_executable(updater

View file

@ -4,6 +4,8 @@
#include "UpdateScript.h"
#include "UpdaterOptions.h"
#include "tinythread.h"
#if defined(PLATFORM_WINDOWS)
#include "UpdateDialogWin32.h"
#elif defined(PLATFORM_MAC)
@ -14,11 +16,14 @@
#include <iostream>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
void setupUi(UpdateInstaller* installer);
void runUpdaterThread(void* arg)
{
UpdateInstaller* installer = static_cast<UpdateInstaller*>(arg);
installer->run();
}
int main(int argc, char** argv)
{
UpdaterOptions options;
@ -49,7 +54,7 @@ int main(int argc, char** argv)
installer.setScript(&script);
installer.setWaitPid(options.waitPid);
boost::thread updaterThread(boost::bind(&UpdateInstaller::run,&installer));
tthread::thread updaterThread(runUpdaterThread,&installer);
updaterThread.join();
return 0;