This commit is contained in:
jeanlemotan
2024-07-02 18:10:39 +02:00
commit 48ab06b1d9
733 changed files with 321088 additions and 0 deletions
@@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>EAThread Additional Reading</title>
<meta name="description" content="Provides references to additional documents regarding multithreading."></head><body>
<h1>Additional Reading</h1>
<p>One of the best ways to become familiar with the many facets of
multithreading is to read the current literature. This literature
consists of books, technical papers, online discussions and FAQs. Here
are a few significant links regarding multithreaded programming in
general. Note that much of the online dicussions regarding
multithreading is Unix-centric and views by authors are sometimes
unreasonably hostile to non-Unix-centric multithreading paradigms.</p>
<h3>Books about threading</h3>
<p><a href="http://www.amazon.com/exec/obidos/tg/detail/-/0131900676">Thread Time: The MultiThreaded Programming Guide</a>, by Norton and DiPasquale<br>
<a href="http://www.amazon.com/exec/obidos/tg/detail/-/0201633922/002-3929909-2459261?v=glance">Programming&nbsp; with Posix Threads</a>, by Butenhof<br>
<a href="http://www.amazon.com/exec/obidos/tg/detail/-/0134436989/">Threads Primer: A Guide to Multithreaded Programming</a>, by Lewis and Berg<br>
<span class="sans"><a href="http://www.amazon.com/exec/obidos/tg/detail/-/0201310090">Concurrent Programming in Java(TM): Design Principles and Pattern</a>, by Lea</span></p>
<h3>Online Posix threading documentation</h3>
<p><a href="http://www.opengroup.org/onlinepubs/007904975/basedefs/pthread.h.html">http://www.opengroup.org/onlinepubs/007904975/basedefs/pthread.h.html</a></p>
<h3>Windows threading</h3>
<p><a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/processes_and_threads.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/processes_and_threads.asp</a></p>
<h3>Linux threading</h3>
<p><a href="http://kerneltrap.org/node/422">http://kerneltrap.org/node/422</a></p>
<h3>Macintosh threading </h3>
<p><a href="http://developer.apple.com/macosx/multithreadedprogramming.html">http://developer.apple.com/macosx/multithreadedprogramming.html</a><br>
<a href="http://developer.apple.com/technotes/tn/tn2028.html">http://developer.apple.com/technotes/tn/tn2028.html </a> </p>
<h3>Discussions</h3>
<p><a href="news://comp.programming.threads">news://comp.programming.threads</a> (note that this discussion group is marred by the presence of some trolls) <br>
<a href="http://www.talkaboutprogramming.com/group/comp.programming.threads/">http://www.talkaboutprogramming.com/group/comp.programming.threads/</a> <small>(same as usenet but more accessible for some)</small></p>
<h3>FAQs</h3>
<p><a href="http://www.openmp.org/index.cgi?faq">http://www.openmp.org/index.cgi?faq</a><br>
<a href="http://www.lambdacs.com/cpt/MFAQ.html">http://www.lambdacs.com/cpt/MFAQ.html</a><br>
<a href="http://www.lambdacs.com/cpt/FAQ.html">http://www.lambdacs.com/cpt/FAQ.html</a></p>
<h3>Third-Party Threading Libraries</h3>
<p>ACE: <a href="http://www.cs.wustl.edu/%7Eschmidt/ACE-overview.html">http://www.cs.wustl.edu/~schmidt/ACE-overview.html</a><br>
Boost: <a href="http://www.boost.org/libs/thread/doc/index.html">http://www.boost.org/libs/thread/doc/index.html</a><br>
ZThreads: <a href="http://zthread.sourceforge.net/html/hierarchy.html">http://zthread.sourceforge.net/html/hierarchy.html</a></p>
<h3>Miscellaneous Reading</h3>
<p><a href="http://www-106.ibm.com/developerworks/java/library/j-king.html">http://www-106.ibm.com/developerworks/java/library/j-king.html</a><br>
<br>
</p>
<hr style="width: 100%; height: 2px;">End of document<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>
+159
View File
@@ -0,0 +1,159 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>EACallstack</title>
<link type="text/css" rel="stylesheet" href="UTFDoc.css">
<meta name="author" content="Paul Schlegel">
<style type="text/css">
<!--
.style1 {color: #0033CC}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<h1>EACallstack</h1>
<h2>Introduction</h2>
<p>The EACallstack package includes functionality to retrieve callstacks at runtime, convert callstacks to symbol names, locations, or source code, disassemble code, read PS3 (eventually other platform) crash dumps, read machine thread contexts, and related functionality. It supports code in DLLs (or other platform equivalents).</p>
<p>EACallstack works on the following platforms:
<ul>
<li>PS3</li>
<li>XBox 360</li>
<li>Wii</li>
<li>Windows / x86, x64</li>
<li>Macintosh / x86, x64</li>
<li>Linux / x86, x64</li>
<li>Mobile / ARM</li>
<li>PS2</li>
</ul>
</p>
<p>The Callstack namespace is the primary namespace of the EACallstack package.
It defines the methods used to initialize and shut down EACallstack, and it
defines methods for the following functions that are fundamental to all
EACallstack operations:</p>
<ul>
<li>To get the value of the current instruction pointer</li>
<li>To get the callstack, expressed as an array of instruction pointers, for
any thread</li>
</ul>
<p>All of these functions return instruction pointers. In order to obtain
human-readable debugging information, an instruction pointer can be passed to
other classes within EACallstack, such as <a href="EAAddressRep.html">
EAAddressRep</a> or <a href="EADasm.html">EADasm</a>.
<a href="EAAddressRep.html">EAAddressRep</a> can be used for looking up symbol
information such as the function name, source file, line number, and source code
text associated with a program address. <a href="EADasm.html">EADasm</a> can be used
for disassembling machine code at a program address.</p>
<p>By using the functions defined in the Callstack namespace in conjunction
with other classes defined in EACallstack, it is possible for an executable
running on a console platform to construct failure reports with a wide variety
of debugging information that can be immediately useful to a developer, without
the need for external symbol lookup tools or other translation steps.</p>
<h2>Example usage </h2>
<p>Here's example usage for how to use GetCallstack:</p>
<pre class="code-example">void YourApp::Initialize()
{
#ifdef EA_DEBUG // EACallstack is likely for debug-only configurations.
<span class="style1"> Callstack::InitCallstack();
<font color="#000000"> #endif</font></span>
}
void YourApp::OutputCallstack()
{
void* pCallstack[32];
size_t nCallstackDepth = <font color="#0033CC">GetCallstack(pCallstack, 32, NULL); </font>// NULL == use current thread context
for(size_t i = 0; i &lt; nCallstackDepth; ++i)
{
const void* const pCallstackAddress = pCallstack[i];
// Get the symbol information for pCallstackAddress via GetAddressRep here.
// See the documentation for <a href="EAAddressRep.html">EAAddressRep</a>.
//
// ... and/or ...
//
// Get the machine code disassembly for pCallstackAddress via EADasm here.
// See the documentation for <a href="EADasm.html">EADasm</a>.
}
}
void YourApp::Shutdown()
{
#ifdef EA_DEBUG
<span class="style1"> Callstack::ShutdownCallstack();
<font color="#000000"> #endif</font></span>
}</pre>
<h2>Interface</h2>
<p>Methods for the initialization and shutdown of the EACallstack package,
defined in the EACallstack.h header file:</p>
<pre class="code-example"><span class="code-example-comment">/// InitCallstack
///
/// Allows the user to explicitly initialize the callstack mechanism.
/// Only the first call to InitCallstack will have effect. Calls to
/// InitCallstack must be matched by calls to ShutdownCallstack.
///
</span>void InitCallstack();
<span class="code-example-comment">/// ShutdownCallstack
///
/// Allows the user to explicitly shutdown the callstack mechanism.
/// Calls to InitCallstack must be matched by calls to ShutdownCallstack.
/// The last call to ShutdownCallstack will shutdown and free the callstack mechanism.
///
</span>void ShutdownCallstack();</pre>
<p>The GetCallstack function:</p>
<pre class="code-example"><span class="code-example-comment">/// GetCallstack
///
/// Gets the addresses of the calling instructions of a call stack.
/// If the CallstackContext parameter is used, then that execution context is used;
/// otherwise the current execution context is used.
/// The return value is the number of entries written to the callstack array.
/// The item at callstack[0] is always the address of the instruction calling the
/// GetCallstack function. This is conceptually identical to placing a breakpoint in
/// a debugger at the point where the GetCallstack function is called.
/// The maxDepth parameter must be at least one.
///
</span>size_t GetCallstack(void* callstack[], size_t maxDepth, CallstackContext* pContext = NULL);</pre>
<p>The GetCallstackContext function, for use when obtaining the callstack of a
particular thread:</p>
<pre class="code-example"><span class="code-example-comment">/// GetCallstackContext
///
/// Gets the CallstackContext associated with the given thread.
/// The thread must be in a non-running state.
/// If the threadID is EAThread::kThreadIdInvalid, the current thread context is retrieved.
/// The threadId parameter is the same type as an EAThread ThreadId. It is important to
/// note that an EAThread ThreadId under Microsoft platforms is a thread handle and not what
/// Microsoft calls a thread id. This is by design as Microsoft thread ids are second class
/// citizens and likely wouldn't exist if it not were for quirks in the Windows API evolution.
///
</span>bool GetCallstackContext(CallstackContext&amp; context, intptr_t threadId = 0);</pre>
<p>The EAGetInstructionPointer macro:</p>
<pre class="code-example"><span class="code-example-comment">/// EAGetInstructionPointer
///
/// Returns the current instruction pointer (a.k.a. program counter).
/// This function is implemented as a macro, it acts as if its declaration
/// were like so:
/// void EAGetInstructionPointer(void*&amp; p);
///
/// For portability, this function should only be used as a standalone
/// statement on its own line.
///
/// Example usage:
/// void* pInstruction;
/// EAGetInstructionPointer(pInstruction);
///
</span>&lt;... implementation not shown ...&gt;</pre>
<hr>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p></p>
</body>
</html>
@@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<meta http-equiv="Refresh" content="0; URL=doxygen/html/index.html"><title>Class Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css"></head>
<body>
<!-- Generated by Doxygen 1.3.3 -->
<h1>Class Documentation</h1>
<p>This page is set to redirect you to the <a href="doxygen/html/index.html">EAThread doxygen documentation</a>. If you are not taken then there you can manually click the link here yourself. If the documentation is not present, then that means you need to manually generate it with doxygen, as not all EAThread distributions come with built Doxygen documentation. Simply run &quot;doxygen.exe doxygen/eathread.doxygen.config&quot; to build the documentation. </p>
<p>&nbsp;</p>
</body></html>
@@ -0,0 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Design Considerations</title>
<style type="text/css">
<!--
.style1 {font-family: "Courier New", Courier, mono}
-->
</style>
</head><body>
<h1>Design Considerations</h1>
<h3>Design</h3>
<p>Many of the design criteria for EA::Thread is based on the design of
the Posix threading standard. The Posix threading standard is designed
to work portably on a wide range of operating systems and hardware,
including embedded systems and realtime environments. As such, Posix
threads generally represent a competent model to follow where possible.
Windows and various other platforms have independent multi-threading
systems which are taken into account here as well. If something exists
in Windows but doesn't exist here (e.g. Thread suspend/resume), there
is a decent chance that it is by design and for some good reason.</p>
<h3>C++</h3>
<p>There are a number of C++ libraries devoted to multithreading. Usually
the goal of these libraries is provide a platform independent interface
which simplifies the most common usage patterns and helps prevent
common errors. Some of these libraries are basic wrappers around
existing C APIs while others (e.g. ZThreads) provide a new and
different paradigm. We take the former approach here, as it is provides
more or less the same functionality but provides it in a
straightforward way that is easily approached by those familiar with
platform-specific APIs. This approach has been referred to as the "Wrapper Facade Pattern".</p>
<h3>Condition Variables / Monitors</h3>
<p>Posix condition variables are implemented via the Condition class.
For all practical purposes, "monitor" is the Java and C# name for Posix' condition variables. To
some, a condition variable may seem similar to a Win32 Signal. In
actuality they are similar but there is one critical difference: a
Signal does not atomically unlock a mutex as part of the signaling
process. This results in problematic race conditions that make reliable
producer/consumer systems impossible to implement correctly.</p>
<h3>Events / Signals</h3>
<p>EAThread
doesn't have an Event or Signal because it is not useful for most
practical
situations. You usually instead want to use a Semaphore or Condition.
An
Event as defined by Windows is not the same thing as a Condition
(condition variable) and
cannot be safely used in its place. Events cannot be used to do what a
Condition does primarily due to race conditions. There may nevertheless
be some use for events, though they won't be implemented in EAThread
until and unless deemed useful. Given that Posix threading has
undergone numerous scrutinized revisions without adding an event
system, it is probably arguable that events are not necessary. A
publicly available discussion on the topic of implementing events under
Posix threads which could be applied to EAThread is here: <a href="http://developers.sun.com/solaris/articles/waitfor_api.html">http://developers.sun.com/solaris/articles/waitfor_api.html</a>. Check the EAThread package's scrap directory for a possible implementation of events in EAThread in the future.</p>
<h3>Timeouts</h3>
<p>Timeouts are specified as absolute times and not relative times. This
may not be how Win32 threading works but it is what's proper and is how
Posix threading works. From the OpenGroup <a href="http://www.opengroup.org/onlinepubs/007904975/functions/pthread_cond_wait.html">online</a> pthread (Posix) documentation:<br>
</p>
<div style="margin-left: 40px;"> An absolute time measure was chosen for
specifying the timeout parameter for two reasons. First, a relative
time measure can be easily implemented on top of a function that
specifies absolute time, but there is a race condition associated with
specifying an absolute timeout on top of a function that specifies
relative timeouts. For example, assume that clock_gettime() returns the
current time and cond_relative_timed_wait() uses relative timeouts:<br>
<br>
<span class="style1">&nbsp;&nbsp; clock_gettime(CLOCK_REALTIME, &amp;now);<br style="font-family: monospace;">
&nbsp;&nbsp; reltime = sleep_til_this_absolute_time - now;<br style="font-family: monospace;">
&nbsp;&nbsp; cond_relative_timed_wait(c, m, &amp;reltime);<br>
</span><br style="font-family: monospace;">
If the thread is preempted between the first statement and the
last statement, the thread blocks for too long. Blocking, however, is
irrelevant if an absolute timeout is used. An absolute timeout also
need not be recomputed if it is used multiple times in a loop, such as
that enclosing a condition wait. For cases when the system clock is
advanced discontinuously by an operator, it is expected that
implementations process any timed wait expiring at an intervening time
as if that time had actually occurred.<br>
</div>
<br>
<br>
<br>
</body></html>
+39
View File
@@ -0,0 +1,39 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>ReadMe</title></head><body>
<h1>ReadMe</h1>
<h3>What is EAThread</h3>
<p>EAThread is a package that implements a unified cross-platform
interface for multithreaded programming on various platforms. The
implementation is clean, efficient, and comprehensive. The package is
suitable for basic threading needs such as the creation of multiple
threads and mutual exclusion. It additionally contains features that
are suitable for advanced threading needs required by next generation
console platforms and advanced uses with existing PC and server
platforms.</p>
<h3>Legal</h3>
<p>EAThread is usable for all uses within Electronic Arts, both internally
and in shipping products for all platforms. All source code was written
by a single EA engineer and none of the source code comes from an
external source. </p>
<h3>This Documentation</h3>
<p>Each of the documents in this directory stands alone, though some of
the documents have links to others. Simply open any of the HTML
documents with your browser to read the given file. </p>
<h3>Where to Go Next</h3>
<p>If this is the first document you are reading then the next document you will want to read is the <a href="./UserGuide.html">User Guide</a>. <br>
<br>
</p>
<hr style="width: 100%; height: 2px;">End of document<br>
<br>
<br>
</body></html>
+92
View File
@@ -0,0 +1,92 @@
body
{
font-family: Palatino Linotype, Book Antiqua, Times New Roman;
font-size: 11pt;
}
h1
{
font-family: Verdana;
display: block;
background-color: #FFF0B0;
border: solid 2px black;
font-size: 16pt;
font-weight: bold;
padding: 6px;
}
h2
{
font-size: 14pt;
font-family: Verdana;
border-bottom: 2px solid black;
}
h3
{
font-family: Verdana;
font-size: 13pt;
font-weight: bold;
}
.code-example
{
display: block;
background-color: #e0e0f0;
margin-left: 3em;
margin-right: 3em;
margin-top: 1em;
margin-bottom: 1em;
padding: 8px;
border: solid 2px #a0a0d0;
font-family: monospace;
font-size: 10pt;
white-space: pre;
}
.code-example-span
{
font-family: monospace;
font-size: 10pt;
white-space: pre;
}
.code-example-comment
{
background-color: #e0e0f0;
padding: 0px 0px;
font-family: monospace;
font-size: 10pt;
white-space: pre;
color: #999999;
margin: auto auto;
}
.faq-question
{
background-color: #D0E0D0;
font-size: 12pt;
font-weight: bold;
margin-bottom: 0.5em;
margin-top: 0em;
padding-left:8px;
padding-right:8px;
padding-top:2px;
padding-bottom:2px
}
.faq-answer
{
display: block;
margin: 4pt 1em 0.5em 1em;
}.box_indent {
margin-left: 3em;
}
.grayed_text {
color: #CCCCCC;
}
.unobtrusive_link {
text-decoration:none;
color:#000066;
}
+364
View File
@@ -0,0 +1,364 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<style type="text/css">
<!--
.style1 {font-family: "Courier New", Courier, mono}
-->
</style>
</head>
<body>
<h1>User Guide</h1>
<h3>Introduction</h3>
<p>This document provides a brief description of the EAThread modules and
then provides some basic information on using these modules. You will
want to consult documentation for individual modules for more detailed
information about them. </p>
<p>All code is in C++ and largely follows the EA coding guidelines as of
January of 2004. All classes are in the EA::Thread C++ namespace.
Thus, the fully qualified name of the Mutex class is
EA::Thread::Mutex. Most of the code is plain C++ and
doesn't attempt to be very academic with the language. Thus RTTI is not
used, template usage is used only in one module (FixedAllocator),
exception handling is not used, etc. Unit tests have been set up for
most of the functionality and are available with the full package. The
headers are heavily commented in Doxygen-savvy format and the source
code for the primary modules has been heavily commented as well. </p>
<h3>EAThread Modules<span style="font-weight: bold;"></span>
</h3>
<div style="margin-left: 40px;">
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;" valign="top"><span style="font-weight: bold;">Module</span><br>
</td>
<td style="vertical-align: top;" valign="top"><span style="font-weight: bold;">Description</span></td>
<td style="vertical-align: top;" valign="top"><span style="font-weight: bold;">Source</span><br>
</td>
<td style="vertical-align: top;" valign="top"><span style="font-weight: bold;">Dependencies</span><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Thread<br>
</td>
<td style="vertical-align: top;" valign="top"> Implements the creation and
control of individual threads. <br>
</td>
<td style="vertical-align: top;" valign="top">eathread.h/cpp<br>
eathread_thread.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">EABase</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Storage<br>
</td>
<td style="vertical-align: top;" valign="top">Implements thread-specific
storage (a.k.a. thread-local storage). This is a mechanism whereby a given
named global variable exists not once globally but exists once per thread.
Each thread gets its own view of the variable. <br>
</td>
<td style="vertical-align: top;" valign="top">eathread_storage.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathead.h/cpp<br>
eathread_mutex.h/cpp*<br>
<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Atomic</td>
<td style="vertical-align: top;" valign="top">Implements atomic operations
on integers and pointers. These are useful for doing thread-safe basic
operations and tests on integers or pointers without the cost of more
expensive synchronization primitives such as mutexes.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_atomic.h<br>
</td>
<td style="vertical-align: top;" valign="top">EABase</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Mutex<br>
</td>
<td style="vertical-align: top;" valign="top">Implements traditional mutual
exclusion. Mutexes here encompass critical section functionality (a.k.a.
futex) and traditional cross-process exclusion.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_mutex.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Futex</td>
<td style="vertical-align: top;" valign="top">Implements a fast mutex. A fast mutex is a mutex which can be faster because it acts entirely within user space within the current process and can possibly have some of its code inlined. </td>
<td style="vertical-align: top;" valign="top">eathread_futex.h/cpp</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">ReadWriteMutex<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a mutex that allows
multiple concurrent reading threads but only one writing thread. This
is useful for situations where one thread is updating a state but multiple
threads may be reading that state.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_rwmutex.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top"><font size="-2"></font>EABase<br>
eathread.h/cpp<br>
eathread_atomic.h<br>
eathread_condition.h/cpp </td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Semaphore<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a traditional sempahore.
A semaphore has zero or positive count associated with it; a thread can
'grab' the semaphore if the count is greater than zero and grabbing it
reduces its count by one. When the count is zero, threads must wait until
it is incremented, which can be done arbitrarily. The semaphore is the
primitive upon which all other high level primitives can be constructed.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_semaphore.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp<br>
eathread_atomic.h<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Condition<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a condition variable,
which is a synchronization primitive that supports the producer/consumer
pattern. It is for all practical purposes also known as a "monitor" in
Java and C#. This primitive is particularly useful for implementing efficient
cross thread-messaging systems or worker thread job implementations.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_condition.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp<br>
eathread_atomic.h<br>
eathread_mutex.h/cpp eathread_semaphore.h/cpp<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">Barrier<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a cyclic barrier
primitive. A barrier is a primitive which coordinates the completion of
work by a predetermined number of threads. A barrier has an integer max
"height" and a current height associated with it. When a thread hits the
barrier, it blocks until the prescribed number of threads hit the barrier,
then all are freed.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_barrier.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">
<p>EABase<br>
eathread.h/cpp<br>
eathread_atomic.h<br>
eathread_semaphore.h/cpp<br>
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">SpinLock<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a traditional spin
lock. A spin lock is a special kind of mutex that "spins" in a loop waiting
to be able to continue instead of blocking like a mutex. A spinlock is
more efficient than a mutex but it generally doesn't work unless operating
on a true multi-processing system. When it does work on a true multi-processing
system it is inefficient.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_spinlock.h<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp<br>
eathread_sync.h <br>
eathread_atomic.h<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">ReadWriteSpinLock<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a spinlock that
allows multiple readers but only a single writer. Otherwise it is similar
to a basic spin lock with respect to purpose and applicability. <br>
</td>
<td style="vertical-align: top;" valign="top">eathread_rwspinlock.h<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp<br>
eathread_sync.h <br>
eathread_atomic.h<br>
</td>
</tr><tr>
<td style="vertical-align: top;" valign="top">ThreadPool<br>
</td>
<td style="vertical-align: top;" valign="top">Implements a "pool" of worker
threads available for work. These are commonly used by server systems
to spawn off client-server tasks.<br>
</td>
<td style="vertical-align: top;" valign="top">eathread_pool.h/cpp<br>
</td>
<td style="vertical-align: top;" valign="top">EABase<br>
eathread.h/cpp<br>
eathread_thread.h/cpp<br>
eathread_condition.h/cpp<br>
eathread_atomic.h<br>
eathread_list.h</td>
</tr><tr>
<td style="vertical-align: top;" valign="top">Sync<br>
</td>
<td style="vertical-align: top;" valign="top">Implements memory synchronization
primitives known as "fences" or "barriers" (not to be confused with thread
barrier primitives). These primitives are useful on multiprocessing platforms
for synchronizing the various processors' view of memory, which can become
"unsynchronized" in the presence of per-processor caches. <br>
</td>
<td style="vertical-align: top;" valign="top">eathread_sync.h<br>
</td>
<td style="vertical-align: top;" valign="top">EABase</td>
</tr><tr>
<td style="vertical-align: top;" valign="top">shared_ptr_mt<br>
shared_array_mt<br>
</td>
<td style="vertical-align: top;" valign="top">These are multithread-safe
equivalents to regular smart pointers such as shared_ptr and shared_array.
See the TL (Template Library) for implementations of the regular versions
of these smart pointers.<br>
</td>
<td style="vertical-align: top;" valign="top">shared_ptr_mt.h<br>
shared_array_mt.h</td>
<td style="vertical-align: top;" valign="top">
<p>eathread_atomic.h<br>
eathread_mutex.h <br>
</p>
</td>
</tr>
</tbody>
</table>
<p>* May not be required, depending on your platform/configuration.<br>
</p>
</div>
<h3><span style="font-weight: bold;"></span> Examples</h3>
<p>We present some
very basic examples of how to use some of the EAThread modules. These
exemplify the simplest uses of these modules and don't go into more
advanced or complicated uses. There is more functionality in each of
the classes than shown; see the documentation or header files for more
information. For clarity, the examples assume that the code has
specified the <span style="font-family: monospace;">using EA::Thread;</span> namespace statement.<br>
<br>
How to create a thread.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_thread.h"<br>
<br>
int ThreadFunction(void* pContext){<br>
&nbsp;&nbsp; return 0;<br>
}<br>
<br>
Thread thread;<br>
thread.Begin(ThreadFunction);</p>
</blockquote>
<p>How to use thread-local storage.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_storage.h"<br>
<br>
ThreadLocalStorage tls;<br>
tls.SetValue("hello");<br>
const char* pString = (const char*)tls.GetValue();</p>
</blockquote>
<p>How to create and use an atomic integer.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_atomic.h"<br>
<br>
AtomicInteger i = 5;<br>
i += 7;<br>
--i;<br>
if(i.SetValueConditional(3, 6))<br>
&nbsp;&nbsp; printf("i was 6 and now is 3.");</p>
</blockquote>
<p>How to create and use a mutex.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_mutex.h"<br>
<br>
Mutex mutex(NULL, true);<br>
mutex.Lock();<br>
mutex.Unlock();</p>
</blockquote>
<p>How to create and use a futex.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_futex.h"<br>
<br>
Futex futex;<br>
futex.Lock();<br>
futex.Unlock();</p>
</blockquote>
<p>How to create and use a semaphore.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_semaphore.h"<br>
<br>
Semaphore semaphore(NULL, true);<br>
semaphore.Post();<br>
semaphore.Wait();</p>
</blockquote>
<p>How to create and use a condition variable.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_condition.h"<br>
<br>
Condition condition(NULL, true);<br>
Mutex&nbsp;&nbsp;&nbsp;&nbsp; mutex(NULL, true);<br>
condition.Signal();<br>
condition.Wait(&amp;mutex);</p>
</blockquote>
<p>How to create and use a spin lock.</p>
<blockquote>
<p class="style1">#include "eathread/eathread_spinlock.h"<br>
<br>
SpinLock spinLock;<br>
spinLock.Lock();<br>
spinLock.Unlock();</p>
</blockquote>
<p>How to create and use a shared_ptr_mt.</p>
<blockquote>
<p><span class="style1">#include "eathread/shared_ptr_mt.h"<br>
<br>
shared_ptr_mt pObject(new SomeClass);<br>
pObject-&gt;DoSomething();</span></p>
</blockquote>
<hr style="width: 100%; height: 2px;">End of document<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
@@ -0,0 +1,210 @@
# Doxyfile 1.3.3
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = EAThread
PROJECT_NUMBER = 1.04.00
OUTPUT_DIRECTORY = ./
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SHOW_USED_FILES = YES
SUBGROUPING = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = "../../include/eathread/" \
"../../source/"
FILE_PATTERNS = *.h* \
*.c*
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 200
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =