Click here to Skip to main content
12,247,258 members (55,287 online)
Click here to Skip to main content

Stats

298.2K views
28.2K downloads
532 bookmarked
Posted

Genetic Algorithm Library

, 7 Apr 2012 GPL3
A framework for genetic algorithms
TSP.exe
GeneticLibrary.dll
TestApp1.exe
TestApp2.exe
GaSchedule.exe
GaSchedule.cfg
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
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
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::GaSectionLock Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<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="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespace_threading.html">Threading</a>::<a class="el" href="class_threading_1_1_ga_section_lock.html">GaSectionLock</a>
  </div>
</div>
<div class="contents">
<h1>Threading::GaSectionLock Class Reference</h1><!-- doxytag: class="Threading::GaSectionLock" --><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="#_details">More...</a>
<p>
<code>#include &lt;source/Threading.h&gt;</code>
<p>

<p>
<a href="class_threading_1_1_ga_section_lock-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_section_lock.html#d731398b1abda833e10f007dfef76c68">GaSectionLock</a> (<a class="el" href="class_threading_1_1_ga_critical_section.html">GaCriticalSection</a> *section, bool aquireLock)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor associates new instance of this class with underlying synchronization object.  <a href="#d731398b1abda833e10f007dfef76c68"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_section_lock.html#dd40696f9734eea6aae2017578cd611f">~GaSectionLock</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor releases underlying synchronization object if it was acquired by this 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> class.  <a href="#dd40696f9734eea6aae2017578cd611f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_section_lock.html#1b41df52e57b10adc120d24f1fe38860">Lock</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>Lock</code> method locks underlying synchronization object. If it was already locked by this 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> class, call has no effect. Details of locking synchronization object are described in specification of <code><a class="el" href="class_threading_1_1_ga_critical_section.html#4cc96d7ecd66795f00f4f5022fbe8ff7" title="Lock method acquires synchronization object and prevents other thread to access protected...">GaCriticalSection::Lock</a></code> method.  <a href="#1b41df52e57b10adc120d24f1fe38860"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_section_lock.html#a9d65604cc6fd4ca117df806eca0b41b">Unlock</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unlock method unlocks underlying synchronization object. If it wasn't locked by this 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> class, call has no effect. Details of unlocking synchronization object are described in specification of <code><a class="el" href="class_threading_1_1_ga_critical_section.html#c517b4515febfe15eeb12eb0132a1002" title="Unlock method release synchronization object and wakes threads which was put to wait...">GaCriticalSection::Unlock</a></code> method.  <a href="#a9d65604cc6fd4ca117df806eca0b41b"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_threading_1_1_ga_critical_section.html">GaCriticalSection</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_threading_1_1_ga_section_lock.html#a12732eb745ac9d60efcc8bc36f9686e">_section</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pointer to underlying synchronization object which is managed by this lock.  <a href="#a12732eb745ac9d60efcc8bc36f9686e"></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="class_threading_1_1_ga_section_lock.html#4b2eb09fd3519ae5259d11423b3b06bd">_locked</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Keeps track whether underlying synchronization object is locked by this 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> class.  <a href="#4b2eb09fd3519ae5259d11423b3b06bd"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<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>. 
<p>
Object of this class shouldn't be used from multiple threads simultaneously. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="d731398b1abda833e10f007dfef76c68"></a><!-- doxytag: member="Threading::GaSectionLock::GaSectionLock" ref="d731398b1abda833e10f007dfef76c68" args="(GaCriticalSection *section, bool aquireLock)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Threading::GaSectionLock::GaSectionLock           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_threading_1_1_ga_critical_section.html">GaCriticalSection</a> *&nbsp;</td>
          <td class="paramname"> <em>section</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>aquireLock</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>
Constructor associates new instance of this class with underlying synchronization object. 
<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>section</em>&nbsp;</td><td>pointer to underlying synchronization object.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>aquireLock</em>&nbsp;</td><td>if this parameter is set to <code>true</code> constructor tries to acquire underlying object immediately.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="dd40696f9734eea6aae2017578cd611f"></a><!-- doxytag: member="Threading::GaSectionLock::~GaSectionLock" ref="dd40696f9734eea6aae2017578cd611f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Threading::GaSectionLock::~GaSectionLock           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Destructor releases underlying synchronization object if it was acquired by this 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> class. 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="1b41df52e57b10adc120d24f1fe38860"></a><!-- doxytag: member="Threading::GaSectionLock::Lock" ref="1b41df52e57b10adc120d24f1fe38860" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Threading::GaSectionLock::Lock           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>Lock</code> method locks underlying synchronization object. If it was already locked by this 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> class, call has no effect. Details of locking synchronization object are described in specification of <code><a class="el" href="class_threading_1_1_ga_critical_section.html#4cc96d7ecd66795f00f4f5022fbe8ff7" title="Lock method acquires synchronization object and prevents other thread to access protected...">GaCriticalSection::Lock</a></code> method. 
<p>

</div>
</div><p>
<a class="anchor" name="a9d65604cc6fd4ca117df806eca0b41b"></a><!-- doxytag: member="Threading::GaSectionLock::Unlock" ref="a9d65604cc6fd4ca117df806eca0b41b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Threading::GaSectionLock::Unlock           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unlock method unlocks underlying synchronization object. If it wasn't locked by this 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> class, call has no effect. Details of unlocking synchronization object are described in specification of <code><a class="el" href="class_threading_1_1_ga_critical_section.html#c517b4515febfe15eeb12eb0132a1002" title="Unlock method release synchronization object and wakes threads which was put to wait...">GaCriticalSection::Unlock</a></code> method. 
<p>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="a12732eb745ac9d60efcc8bc36f9686e"></a><!-- doxytag: member="Threading::GaSectionLock::_section" ref="a12732eb745ac9d60efcc8bc36f9686e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_threading_1_1_ga_critical_section.html">GaCriticalSection</a>* <a class="el" href="class_threading_1_1_ga_section_lock.html#a12732eb745ac9d60efcc8bc36f9686e">Threading::GaSectionLock::_section</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Pointer to underlying synchronization object which is managed by this lock. 
<p>

</div>
</div><p>
<a class="anchor" name="4b2eb09fd3519ae5259d11423b3b06bd"></a><!-- doxytag: member="Threading::GaSectionLock::_locked" ref="4b2eb09fd3519ae5259d11423b3b06bd" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="class_threading_1_1_ga_section_lock.html#4b2eb09fd3519ae5259d11423b3b06bd">Threading::GaSectionLock::_locked</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Keeps track whether underlying synchronization object is locked by this 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> class. 
<p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>source/<a class="el" href="_threading_8h.html">Threading.h</a></ul>
</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

You may also be interested in...

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