Click here to Skip to main content
11,410,750 members (62,942 online)
Click here to Skip to main content
Add your own
alternative version

Genetic Algorithm Library

, 7 Apr 2012 GPL3
A framework for genetic algorithms
galdemoapps.zip
TSP.exe
GeneticLibrary.dll
TestApp1.exe
TestApp2.exe
GaSchedule.exe
GaSchedule.cfg
GalDemoSource.zip
TestApp1
TestApp1.vcxproj.filters
TestApp2
TestApp2.vcxproj.filters
TSP
res
.svn
entries
prop-base
Toolbar.bmp.svn-base
TSP.ico.svn-base
props
text-base
Toolbar.bmp.svn-base
TSP.ico.svn-base
TSP.rc2.svn-base
tmp
prop-base
props
text-base
Toolbar.bmp
TSP.ico
TSP.vcxproj.filters
GaSchedule
Algorithm
GaSchedule.cfg
GaSchedule.vcxproj.filters
res
GaSchedule.ico
galdocumentation.zip
doxygen.png
Graphic
ab_cp.png
alg_st.png
a_cr.png
c_cp.png
i_cp.png
mp_cr.png
mv_cr.png
r_cp.png
s_cp.png
s_cr.png
galsource.zip
GeneticLibrary
build
release
gcc_bsd
gcc_linux
gcc_macos
gcc_solaris
icc_linux
icc_macos
icc_win
mingw
msvc
scc_solaris
makefiles
gcc_bsd_debug
gcc_bsd_release
gcc_linux_debug
gcc_linux_release
gcc_macos_debug
gcc_macos_release
gcc_solaris_debug
gcc_solaris_release
icc_linux_debug
icc_linux_release
icc_macos_debug
icc_macos_release
scc_solaris_debug
scc_solaris_release
source
vs
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Genetic Algorithm Library: Threading Namespace Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<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 List</span></a></li>
      <li><a href="namespacemembers.html"><span>Namespace&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Threading Namespace Reference</h1>Contatins classes and types used to abstract operating system specific threads control.  
<a href="#_details">More...</a>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_threading_1_1_ga_thread_parameter.html">GaThreadParameter</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code><a class="el" href="struct_threading_1_1_ga_thread_parameter.html" title="GaThreadParameter structure contains information needed to start new thread. It has...">GaThreadParameter</a></code> structure contains information needed to start new thread. It has pointer to function which is entry point of thread and pointer to parameters which will be passed to the function. Restrictions of entry point's function of a thread are described by <code>GaThreadFunctionPointer</code> type.  <a href="struct_threading_1_1_ga_thread_parameter.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_critical_section.html">GaCriticalSection</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code><a class="el" href="class_threading_1_1_ga_critical_section.html" title="GaCriticalSection class is wrapper class for system synchronization object.">GaCriticalSection</a></code> class is wrapper class for system synchronization object.  <a href="class_threading_1_1_ga_critical_section.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_section_lock.html">GaSectionLock</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code><a class="el" href="class_threading_1_1_ga_section_lock.html" title="GaSectionLock class is used for automatic access control with help of GaCriticalSection...">GaSectionLock</a></code> class is used for automatic access control with help of <a class="el" href="class_threading_1_1_ga_critical_section.html" title="GaCriticalSection class is wrapper class for system synchronization object.">GaCriticalSection</a> class. Synchronization object can be automatically acquired when instance of <code><a class="el" href="class_threading_1_1_ga_section_lock.html" title="GaSectionLock class is used for automatic access control with help of GaCriticalSection...">GaSectionLock</a></code> is created. If synchronization object is locked by instance of <code><a class="el" href="class_threading_1_1_ga_section_lock.html" title="GaSectionLock class is used for automatic access control with help of GaCriticalSection...">GaSectionLock</a></code> it is released when the instance goes out of scope. This mechanism provides simple way of managing critical sections because users don't have to worry about releasing of synchronization object in most cases, but for more complicated cases <code>LOCK</code> and <code>UNLOCK</code> macros can be used with instances of this class or with <a class="el" href="class_threading_1_1_ga_critical_section.html" title="GaCriticalSection class is wrapper class for system synchronization object.">GaCriticalSection</a> class. <code><a class="el" href="class_threading_1_1_ga_section_lock.html" title="GaSectionLock class is used for automatic access control with help of GaCriticalSection...">GaSectionLock</a></code> is mainly employed by <code>LOCK_OBJECT</code> and <code>LOCK_THIS_OBJECT</code>.  <a href="class_threading_1_1_ga_section_lock.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_thread.html">GaThread</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code><a class="el" href="class_threading_1_1_ga_thread.html" title="GaThread class controls system threads. It wraps system specific control of threading...">GaThread</a></code> class controls system threads. It wraps system specific control of threading. This class has built-in synchronizator so it is allowed to use <code>LOCK_OBJECT</code> and <code>LOCK_THIS_OBJECT</code> macros with instances of this class.  <a href="class_threading_1_1_ga_thread.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br>
_SYSTEM_OR_COMPILER_SPECIFIC_&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#c39ee516ee1ae88f49548b9c9e5f99f1">SystemThread</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This type defines system specific type for storing threads objects or handles to them.  <a href="#c39ee516ee1ae88f49548b9c9e5f99f1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br>
_SYSTEM_OR_COMPILER_SPECIFIC_&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#a83f689982d39ae995a27164fdd8386e">SysSyncObject</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This type defines system specific type for storing synchronization objects or handles to them. System specific synchronization is wrapped by <a class="el" href="class_threading_1_1_ga_critical_section.html" title="GaCriticalSection class is wrapper class for system synchronization object.">GaCriticalSection</a> class.  <a href="#a83f689982d39ae995a27164fdd8386e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br>
_SYSTEM_OR_COMPILER_SPECIFIC_&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#82f4c88f477687593b6312dd4ddf4daf">SysSemaphoreObject</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This type defines system specific type for storing semaphores objects or handles to them. Manipulation over semaphores is done by <code>MAKE_SEMAPHORE</code>, <code>FREE_SEMAPHORE</code>, <code>LOCK_SEMAPHORE</code> and <code>UNLOCK_SEMAPHORE</code> macros.  <a href="#82f4c88f477687593b6312dd4ddf4daf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br>
_SYSTEM_OR_COMPILER_SPECIFIC_&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#d35f325115178850c2dfd5b55d10166b">SysEventObject</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This type defines system specific type for storing events objects or handles to them. Manipulation over events is done by <code>MAKE_EVENT</code>, <code>FREE_EVENT</code>, <code>WAIT_FOR_EVENT</code> and <code>SIGNAL_EVENT</code> macros.  <a href="#d35f325115178850c2dfd5b55d10166b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br>
_SYSTEM_OR_COMPILER_SPECIFIC_&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#1ced7e2f567ba5ae9bd76aaa8b6e72b6">ThreadFunctionReturn</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This type is used as return value type for functions which are used as threads' entry points. This type hides system specific types which are used for the purpose.  <a href="#1ced7e2f567ba5ae9bd76aaa8b6e72b6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <br>
_SYSTEM_OR_COMPILER_SPECIFIC_&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#2fb902107a773c3f7cc8e52847f77212">ThreadID</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Variables/objects of this type are used for storing threads' IDs. This type hides system specific types which are used for the purpose.  <a href="#2fb902107a773c3f7cc8e52847f77212"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aa">GaThreadStatus</a> { <a class="el" href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aab5bea800136b60c6294c477a67b82529">GATS_RUNNING</a> =  0x1, 
<a class="el" href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aab54a40184c1981d65d25559ba6ff9a26">GATS_STOPPED</a> =  0x2, 
<a class="el" href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aadf256fcdf7ba11725937d2c8a17b06a0">GATS_PAUSED</a> =  0x4, 
<a class="el" href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aa6e0d93935565aee382768b9e28781362">GATS_NOT_RUNNING</a> =  GATS_STOPPED | GATS_PAUSED
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This enumeration defines possible states of threads.  <a href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aa">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#011b400f69a82fbb5ede2436002485d2">MakeSemaphore</a> (<a class="el" href="namespace_threading.html#82f4c88f477687593b6312dd4ddf4daf">SysSemaphoreObject</a> &amp;semaphoreHandle, int maxCount, int initialCount)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to create operating system object for semaphore and to initialize it.  <a href="#011b400f69a82fbb5ede2436002485d2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#5d8ff1beb0e8877019a13adc4ac269e7">DeleteSemaphore</a> (<a class="el" href="namespace_threading.html#82f4c88f477687593b6312dd4ddf4daf">SysSemaphoreObject</a> &amp;semaphoreHandle)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to free operating system semaphore.  <a href="#5d8ff1beb0e8877019a13adc4ac269e7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#d3133ef64c6b40bacc1eecaec9a71eb3">LockSemaphore</a> (<a class="el" href="namespace_threading.html#82f4c88f477687593b6312dd4ddf4daf">SysSemaphoreObject</a> &amp;semaphoreHandle)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to acquire access to critical section protected by semaphore.  <a href="#d3133ef64c6b40bacc1eecaec9a71eb3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#2d49e8ec034bc22671b7a64566d974e7">UnlockSemaphore</a> (<a class="el" href="namespace_threading.html#82f4c88f477687593b6312dd4ddf4daf">SysSemaphoreObject</a> &amp;semaphoreHandle, int count)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to release access to critical section protected by semaphore.  <a href="#2d49e8ec034bc22671b7a64566d974e7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#bfbd486894459c5b901cc511335101bc">MakeEvent</a> (<a class="el" href="namespace_threading.html#d35f325115178850c2dfd5b55d10166b">SysEventObject</a> &amp;eventHandle, bool intialState)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to create operating system object for event and to initialize it.  <a href="#bfbd486894459c5b901cc511335101bc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#89b0439626b7bbf9cca17831cb3f2aa8">DeleteEvent</a> (<a class="el" href="namespace_threading.html#d35f325115178850c2dfd5b55d10166b">SysEventObject</a> &amp;eventHandle)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to free operating system semaphore.  <a href="#89b0439626b7bbf9cca17831cb3f2aa8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#90d344714856f6b3eb5589bc2ee31f3a">WaitForEvent</a> (<a class="el" href="namespace_threading.html#d35f325115178850c2dfd5b55d10166b">SysEventObject</a> &amp;eventHandle)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to block calling thread until event reaches signaled state. When calling thread is released, event is restared to non-signaled state.  <a href="#90d344714856f6b3eb5589bc2ee31f3a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#8ae164997c3136f1625142675ea39562">SignalEvent</a> (<a class="el" href="namespace_threading.html#d35f325115178850c2dfd5b55d10166b">SysEventObject</a> &amp;eventHandle)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function is used to set event to signaled state.  <a href="#8ae164997c3136f1625142675ea39562"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_threading.html#a775501be708d92cb6c7954590d7fd82">ThreadFunctionReturn</a> (GACALL *ThreadFunctionPointer)(<a class="el" href="class_threading_1_1_ga_thread.html">GaThread</a> *</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>ThreadFunctionPointer</code> is pointer to function used as thread's entry point. Entry point function must obey restriction of this type: <br>
1. Function must return value of <a class="el" href="namespace_threading.html#1ced7e2f567ba5ae9bd76aaa8b6e72b6" title="This type is used as return value type for functions which are used as threads&#39;...">ThreadFunctionReturn</a> type. <br>
2. Function must use <code>GACALL</code> calling convention. <br>
3. Function must have two parameters. <br>
4. First parameter must be pointer <a class="el" href="class_threading_1_1_ga_thread.html" title="GaThread class controls system threads. It wraps system specific control of threading...">GaThread</a> (<a class="el" href="class_threading_1_1_ga_thread.html" title="GaThread class controls system threads. It wraps system specific control of threading...">GaThread</a>*). <br>
5. Second parameter must be pointer to <code>void</code> (<code>void</code>*).  <a href="#a775501be708d92cb6c7954590d7fd82"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Contatins classes and types used to abstract operating system specific threads control. 
<p>
<hr><h2>Typedef Documentation</h2>
<a class="anchor" name="d35f325115178850c2dfd5b55d10166b"></a><!-- doxytag: member="Threading::SysEventObject" ref="d35f325115178850c2dfd5b55d10166b" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef HANDLE <a class="el" href="namespace_threading.html#d35f325115178850c2dfd5b55d10166b">Threading::SysEventObject</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This type defines system specific type for storing events objects or handles to them. Manipulation over events is done by <code>MAKE_EVENT</code>, <code>FREE_EVENT</code>, <code>WAIT_FOR_EVENT</code> and <code>SIGNAL_EVENT</code> macros. 
<p>

</div>
</div><p>
<a class="anchor" name="82f4c88f477687593b6312dd4ddf4daf"></a><!-- doxytag: member="Threading::SysSemaphoreObject" ref="82f4c88f477687593b6312dd4ddf4daf" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef HANDLE <a class="el" href="namespace_threading.html#82f4c88f477687593b6312dd4ddf4daf">Threading::SysSemaphoreObject</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This type defines system specific type for storing semaphores objects or handles to them. Manipulation over semaphores is done by <code>MAKE_SEMAPHORE</code>, <code>FREE_SEMAPHORE</code>, <code>LOCK_SEMAPHORE</code> and <code>UNLOCK_SEMAPHORE</code> macros. 
<p>

</div>
</div><p>
<a class="anchor" name="a83f689982d39ae995a27164fdd8386e"></a><!-- doxytag: member="Threading::SysSyncObject" ref="a83f689982d39ae995a27164fdd8386e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef CRITICAL_SECTION <a class="el" href="namespace_threading.html#a83f689982d39ae995a27164fdd8386e">Threading::SysSyncObject</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This type defines system specific type for storing synchronization objects or handles to them. System specific synchronization is wrapped by <a class="el" href="class_threading_1_1_ga_critical_section.html" title="GaCriticalSection class is wrapper class for system synchronization object.">GaCriticalSection</a> class. 
<p>

</div>
</div><p>
<a class="anchor" name="c39ee516ee1ae88f49548b9c9e5f99f1"></a><!-- doxytag: member="Threading::SystemThread" ref="c39ee516ee1ae88f49548b9c9e5f99f1" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef HANDLE <a class="el" href="namespace_threading.html#c39ee516ee1ae88f49548b9c9e5f99f1">Threading::SystemThread</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This type defines system specific type for storing threads objects or handles to them. 
<p>

</div>
</div><p>
<a class="anchor" name="1ced7e2f567ba5ae9bd76aaa8b6e72b6"></a><!-- doxytag: member="Threading::ThreadFunctionReturn" ref="1ced7e2f567ba5ae9bd76aaa8b6e72b6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef int <a class="el" href="namespace_threading.html#1ced7e2f567ba5ae9bd76aaa8b6e72b6">Threading::ThreadFunctionReturn</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This type is used as return value type for functions which are used as threads' entry points. This type hides system specific types which are used for the purpose. 
<p>

</div>
</div><p>
<a class="anchor" name="2fb902107a773c3f7cc8e52847f77212"></a><!-- doxytag: member="Threading::ThreadID" ref="2fb902107a773c3f7cc8e52847f77212" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef DWORD <a class="el" href="namespace_threading.html#2fb902107a773c3f7cc8e52847f77212">Threading::ThreadID</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Variables/objects of this type are used for storing threads' IDs. This type hides system specific types which are used for the purpose. 
<p>

</div>
</div><p>
<hr><h2>Enumeration Type Documentation</h2>
<a class="anchor" name="a6bee8e9f7890591792c78852f0955aa"></a><!-- doxytag: member="Threading::GaThreadStatus" ref="a6bee8e9f7890591792c78852f0955aa" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="namespace_threading.html#a6bee8e9f7890591792c78852f0955aa">Threading::GaThreadStatus</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This enumeration defines possible states of threads. 
<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="a6bee8e9f7890591792c78852f0955aab5bea800136b60c6294c477a67b82529"></a><!-- doxytag: member="GATS_RUNNING" ref="a6bee8e9f7890591792c78852f0955aab5bea800136b60c6294c477a67b82529" args="" -->GATS_RUNNING</em>&nbsp;</td><td>
Thread is running. 
<p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="a6bee8e9f7890591792c78852f0955aab54a40184c1981d65d25559ba6ff9a26"></a><!-- doxytag: member="GATS_STOPPED" ref="a6bee8e9f7890591792c78852f0955aab54a40184c1981d65d25559ba6ff9a26" args="" -->GATS_STOPPED</em>&nbsp;</td><td>
Thread execution is terminated, but thread object still exists and can be used to restart execution. 
<p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="a6bee8e9f7890591792c78852f0955aadf256fcdf7ba11725937d2c8a17b06a0"></a><!-- doxytag: member="GATS_PAUSED" ref="a6bee8e9f7890591792c78852f0955aadf256fcdf7ba11725937d2c8a17b06a0" args="" -->GATS_PAUSED</em>&nbsp;</td><td>
Thread execution is temporary is suspended. 
<p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="a6bee8e9f7890591792c78852f0955aa6e0d93935565aee382768b9e28781362"></a><!-- doxytag: member="GATS_NOT_RUNNING" ref="a6bee8e9f7890591792c78852f0955aa6e0d93935565aee382768b9e28781362" args="" -->GATS_NOT_RUNNING</em>&nbsp;</td><td>
Used for checking running state of thread. 
<p>
</td></tr>
</table>
</dl>

</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="89b0439626b7bbf9cca17831cb3f2aa8"></a><!-- doxytag: member="Threading::DeleteEvent" ref="89b0439626b7bbf9cca17831cb3f2aa8" args="(SysEventObject &amp;eventHandle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::DeleteEvent           </td>
          <td>(</td>
          <td class="paramtype">SysEventObject &amp;&nbsp;</td>
          <td class="paramname"> <em>eventHandle</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to free operating system semaphore. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>eventHandle</em>&nbsp;</td><td>reference to variable that holds reference to event.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the event is successfully freed.</dd></dl>

</div>
</div><p>
<a class="anchor" name="5d8ff1beb0e8877019a13adc4ac269e7"></a><!-- doxytag: member="Threading::DeleteSemaphore" ref="5d8ff1beb0e8877019a13adc4ac269e7" args="(SysSemaphoreObject &amp;semaphoreHandle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::DeleteSemaphore           </td>
          <td>(</td>
          <td class="paramtype">SysSemaphoreObject &amp;&nbsp;</td>
          <td class="paramname"> <em>semaphoreHandle</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to free operating system semaphore. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>semaphoreHandle</em>&nbsp;</td><td>reference to variable that holds reference to semaphore.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the semaphore is successfully freed.</dd></dl>

</div>
</div><p>
<a class="anchor" name="d3133ef64c6b40bacc1eecaec9a71eb3"></a><!-- doxytag: member="Threading::LockSemaphore" ref="d3133ef64c6b40bacc1eecaec9a71eb3" args="(SysSemaphoreObject &amp;semaphoreHandle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::LockSemaphore           </td>
          <td>(</td>
          <td class="paramtype">SysSemaphoreObject &amp;&nbsp;</td>
          <td class="paramname"> <em>semaphoreHandle</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to acquire access to critical section protected by semaphore. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>semaphoreHandle</em>&nbsp;</td><td>reference to variable that holds reference to semaphore.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the semaphore is successfully acquired.</dd></dl>

</div>
</div><p>
<a class="anchor" name="bfbd486894459c5b901cc511335101bc"></a><!-- doxytag: member="Threading::MakeEvent" ref="bfbd486894459c5b901cc511335101bc" args="(SysEventObject &amp;eventHandle, bool intialState)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::MakeEvent           </td>
          <td>(</td>
          <td class="paramtype">SysEventObject &amp;&nbsp;</td>
          <td class="paramname"> <em>eventHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>intialState</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to create operating system object for event and to initialize it. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>eventHandle</em>&nbsp;</td><td>reference to variable which will store handle to newly created event.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>intialState</em>&nbsp;</td><td>initial state of event. Should be to <code>true</code> if event should be in signaled state after it is created, otherwise it should be set to <code>false</code>.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the event is successfully created.</dd></dl>

</div>
</div><p>
<a class="anchor" name="011b400f69a82fbb5ede2436002485d2"></a><!-- doxytag: member="Threading::MakeSemaphore" ref="011b400f69a82fbb5ede2436002485d2" args="(SysSemaphoreObject &amp;semaphoreHandle, int maxCount, int initialCount)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::MakeSemaphore           </td>
          <td>(</td>
          <td class="paramtype">SysSemaphoreObject &amp;&nbsp;</td>
          <td class="paramname"> <em>semaphoreHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>maxCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>initialCount</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to create operating system object for semaphore and to initialize it. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>semaphoreHandle</em>&nbsp;</td><td>variable which will store handle to newly created semaphore.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>maxCount</em>&nbsp;</td><td>maximum count of semaphore, value must be greater then 0. On *nix systems this parameter is ignored.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>initialCount</em>&nbsp;</td><td>initial count of semaphore, value must be greater or equals to the 0 and less then or equals to <code>maxCount</code>.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the semaphore is successfully created.</dd></dl>

</div>
</div><p>
<a class="anchor" name="8ae164997c3136f1625142675ea39562"></a><!-- doxytag: member="Threading::SignalEvent" ref="8ae164997c3136f1625142675ea39562" args="(SysEventObject &amp;eventHandle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::SignalEvent           </td>
          <td>(</td>
          <td class="paramtype">SysEventObject &amp;&nbsp;</td>
          <td class="paramname"> <em>eventHandle</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to set event to signaled state. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>eventHandle</em>&nbsp;</td><td>reference to variable that holds reference to event.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the event is successfully signaled.</dd></dl>

</div>
</div><p>
<a class="anchor" name="a775501be708d92cb6c7954590d7fd82"></a><!-- doxytag: member="Threading::ThreadFunctionReturn" ref="a775501be708d92cb6c7954590d7fd82" args="(GACALL *ThreadFunctionPointer)(GaThread *" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="namespace_threading.html#1ced7e2f567ba5ae9bd76aaa8b6e72b6">Threading::ThreadFunctionReturn</a>           </td>
          <td>(</td>
          <td class="paramtype">GACALL *&nbsp;</td>
          <td class="paramname"> <em>ThreadFunctionPointer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>ThreadFunctionPointer</code> is pointer to function used as thread's entry point. Entry point function must obey restriction of this type: <br>
1. Function must return value of <a class="el" href="namespace_threading.html#1ced7e2f567ba5ae9bd76aaa8b6e72b6" title="This type is used as return value type for functions which are used as threads&#39;...">ThreadFunctionReturn</a> type. <br>
2. Function must use <code>GACALL</code> calling convention. <br>
3. Function must have two parameters. <br>
4. First parameter must be pointer <a class="el" href="class_threading_1_1_ga_thread.html" title="GaThread class controls system threads. It wraps system specific control of threading...">GaThread</a> (<a class="el" href="class_threading_1_1_ga_thread.html" title="GaThread class controls system threads. It wraps system specific control of threading...">GaThread</a>*). <br>
5. Second parameter must be pointer to <code>void</code> (<code>void</code>*). 
<p>

</div>
</div><p>
<a class="anchor" name="2d49e8ec034bc22671b7a64566d974e7"></a><!-- doxytag: member="Threading::UnlockSemaphore" ref="2d49e8ec034bc22671b7a64566d974e7" args="(SysSemaphoreObject &amp;semaphoreHandle, int count)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::UnlockSemaphore           </td>
          <td>(</td>
          <td class="paramtype">SysSemaphoreObject &amp;&nbsp;</td>
          <td class="paramname"> <em>semaphoreHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>count</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to release access to critical section protected by semaphore. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>semaphoreHandle</em>&nbsp;</td><td>reference to variable that holds reference to semaphore.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>amount by which semaphore's count is increased, value must be grater then 0 and sum of the value and current semaphore's count must be less then or equals to maximal count of semaphore.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the semaphore is successfully released.</dd></dl>

</div>
</div><p>
<a class="anchor" name="90d344714856f6b3eb5589bc2ee31f3a"></a><!-- doxytag: member="Threading::WaitForEvent" ref="90d344714856f6b3eb5589bc2ee31f3a" args="(SysEventObject &amp;eventHandle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Threading::WaitForEvent           </td>
          <td>(</td>
          <td class="paramtype">SysEventObject &amp;&nbsp;</td>
          <td class="paramname"> <em>eventHandle</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This function is used to block calling thread until event reaches signaled state. When calling thread is released, event is restared to non-signaled state. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>eventHandle</em>&nbsp;</td><td>reference to variable that holds reference to event.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns <code>true</code> if the thread successfully received signal.</dd></dl>

</div>
</div><p>
</div>
<br/><a href="http://www.coolsoft-sd.com/ProductVersion.aspx?vid=9">Genetic Algorithm Library</a><br/><a href="http://www.coolsoft-sd.com/">Coolsoft Software Development</a>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Mladen Janković
Software Developer
Serbia Serbia
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.5 | Last Updated 7 Apr 2012
Article Copyright 2008 by Mladen Janković
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid