Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > ba6e5e1a033bd8535c43a771ce407926 > files > 207

lib64cxx-gtk-utils2.2-devel-2.2.3-2.mga4.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>c++-gtk-utils: Cgu::SharedLockHandle&lt; T, Dealloc &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">c++-gtk-utils
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</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 id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceCgu.html">Cgu</a></li><li class="navelem"><a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classCgu_1_1SharedLockHandle-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Cgu::SharedLockHandle&lt; T, Dealloc &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__handles.html">handles and smart pointers</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count..  
 <a href="classCgu_1_1SharedLockHandle.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="shared__handle_8h_source.html">c++-gtk-utils/shared_handle.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a254ad1c94e68018d4fa1beacc0209665"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#a254ad1c94e68018d4fa1beacc0209665">SharedLockHandle</a> (T ptr=0)</td></tr>
<tr class="separator:a254ad1c94e68018d4fa1beacc0209665"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3f909be6e779051cdbbaedf7617d4c0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#af3f909be6e779051cdbbaedf7617d4c0">SharedLockHandle</a> (T ptr, <a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165b">Cgu::SharedHandleAllocFail::Leave</a> tag)</td></tr>
<tr class="separator:af3f909be6e779051cdbbaedf7617d4c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef2d14ba2181d36db0cecd59e312b153"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset</a> (T ptr=0)</td></tr>
<tr class="separator:aef2d14ba2181d36db0cecd59e312b153"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb8c88abc488e201ee1f63c8365a18a2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#acb8c88abc488e201ee1f63c8365a18a2">reset</a> (T ptr, <a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165b">Cgu::SharedHandleAllocFail::Leave</a> tag)</td></tr>
<tr class="separator:acb8c88abc488e201ee1f63c8365a18a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a48e7c3d7fc7736208cf716dda585de82"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#a48e7c3d7fc7736208cf716dda585de82">SharedLockHandle</a> (const <a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> &amp;sh_hand) noexcept</td></tr>
<tr class="separator:a48e7c3d7fc7736208cf716dda585de82"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4aa6e9ddffab4af9ace68c41b790073"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#ae4aa6e9ddffab4af9ace68c41b790073">SharedLockHandle</a> (<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> &amp;&amp;sh_hand) noexcept</td></tr>
<tr class="separator:ae4aa6e9ddffab4af9ace68c41b790073"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6518142e137af1200fb1b16f173faf12"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#a6518142e137af1200fb1b16f173faf12">operator=</a> (<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> sh_hand)</td></tr>
<tr class="separator:a6518142e137af1200fb1b16f173faf12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac3c1d1f41e275bf021055ceac2419592"><td class="memItemLeft" align="right" valign="top">T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#ac3c1d1f41e275bf021055ceac2419592">get</a> () const noexcept</td></tr>
<tr class="separator:ac3c1d1f41e275bf021055ceac2419592"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56e539f82122df951b30062a3cd1ed24"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#a56e539f82122df951b30062a3cd1ed24">operator T</a> () const noexcept</td></tr>
<tr class="separator:a56e539f82122df951b30062a3cd1ed24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aacfb662d60523040da18768c3bb21e08"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#aacfb662d60523040da18768c3bb21e08">get_refcount</a> () const noexcept</td></tr>
<tr class="separator:aacfb662d60523040da18768c3bb21e08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd3141dcb093eb4ecca2bc258f6695cc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1SharedLockHandle.html#abd3141dcb093eb4ecca2bc258f6695cc">~SharedLockHandle</a> ()</td></tr>
<tr class="separator:abd3141dcb093eb4ecca2bc258f6695cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt;<br/>
class Cgu::SharedLockHandle&lt; T, Dealloc &gt;</h3>

<p>This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCgu_1_1SharedHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore. ">SharedHandle</a> <a class="el" href="classCgu_1_1ScopedHandle.html" title="This is a generic scoped class for managing the lifetime of objects allocated on freestore. ">ScopedHandle</a> <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">SharedHandleError</a> </dd>
<dd>
<a class="el" href="classCgu_1_1StandardArrayDelete.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls the C++ delete[] expression. ">StandardArrayDelete</a> <a class="el" href="classCgu_1_1CFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls std::free. ">CFree</a> <a class="el" href="classCgu_1_1GFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_free(). ">GFree</a> <a class="el" href="classCgu_1_1GerrorFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_error_free(). ">GerrorFree</a> <a class="el" href="classCgu_1_1GSliceFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_slice_free1(). ">GSliceFree</a> <a class="el" href="classCgu_1_1GSliceFreeSize.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_slice_free1(). ">GSliceFreeSize</a> <a class="el" href="classCgu_1_1GSliceDestroy.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_slice_free1(), but before doing so also explicitly calls the destructor of a C++ object constructed in the memory. ">GSliceDestroy</a></dd></dl>
<p>Class <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> is a version of the <a class="el" href="classCgu_1_1SharedHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore. ">SharedHandle</a> class which includes synchronization so that it can handle objects accessed in multiple threads (although the word Lock is in the title, by default it uses glib atomic functions to access the reference count rather than a mutex, so the overhead should be very small). Note that only the reference count is protected, so this is thread safe in the sense in which a raw pointer is thread safe. A shared handle accessed in one thread referencing a particular object is thread safe as against another shared handle accessing the same object in a different thread. It is thus suitable for use in different standard C++ containers which exist in different threads but which contain shared objects by reference. But:</p>
<ol type="1">
<li>If the referenced object is to be modified in one thread and read or modified in another thread an appropriate mutex for the referenced object is required (unless that referenced object does its own locking).</li>
<li>If the same instance of shared handle is to be modified in one thread (by assigning to the handle so that it references a different object, or by moving from it), and copied (assigned from or used as the argument of a copy constructor), accessed, destroyed or modified in another thread, a mutex for that instance of shared handle is required.</li>
<li>Objects referenced by shared handles which are objects for which POSIX provides no guarantees (in the main, those which are not built-in types), such as strings and similar containers, may not support concurrent reads in different threads. That depends on the library implementation concerned. If that is the case, a mutex for the referenced object will also be required when reading any given instance of such an object in more than one thread by dereferencing any shared handles referencing it (and indeed, when not using shared handles at all).</li>
</ol>
<p><a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> objects can be instantiated for pointers to constant objects (such as SharedLockHandle&lt;const char*&gt;), provided the deleter functor will take such pointers.</p>
<p>This library provides <a class="el" href="classCgu_1_1StandardArrayDelete.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls the C++ delete[] expression. ">StandardArrayDelete</a>, <a class="el" href="classCgu_1_1CFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls std::free. ">CFree</a>, <a class="el" href="classCgu_1_1GFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_free(). ">GFree</a>, <a class="el" href="classCgu_1_1GerrorFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_error_free(). ">GerrorFree</a>, <a class="el" href="classCgu_1_1GSliceFree.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_slice_free1(). ">GSliceFree</a>, <a class="el" href="classCgu_1_1GSliceFreeSize.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_slice_free1(). ">GSliceFreeSize</a> and <a class="el" href="classCgu_1_1GSliceDestroy.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib&#39;s g_slice_free1(), but before doing so also explicitly calls the destructor of a C++ object constructed in the memory. ">GSliceDestroy</a> deleter functors, which can be used as the second template parameter of the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> class. <a class="el" href="classCgu_1_1StandardArrayDelete.html" title="A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls the C++ delete[] expression. ">StandardArrayDelete</a> is the default.</p>
<p>As mentioned, by default glib atomic functions are used to provide thread-safe manipulation of the reference count. However, the symbol CGU_SHARED_LOCK_HANDLE_USE_MUTEX can be defined so that the library uses mutexes instead, which might be useful for some debugging purposes. Note that if CGU_SHARED_LOCK_HANDLE_USE_MUTEX is to be defined, this is best done by textually amending the <a class="el" href="shared__handle_8h.html">shared_handle.h</a> header file before the library is compiled. This will ensure that everything in the program and the library which includes the <a class="el" href="shared__handle_8h.html">shared_handle.h</a> header is guaranteed to see the same definitions so that the C++ standard's one-definition-rule is complied with.</p>
<p><b>Comparison</b> <b>with</b> <b>std::shared_ptr</b> </p>
<p>Although the semantics of std::shared_ptr in C++11 are not particularly suited to managing either arrays or C objects with accessor functions (such as in glib), most of the things that can be done by this class can be done by using std::shared_ptr with a specialised deleter. However, this class is retained in the c++-gtk-utils library not only to retain compatibility with series 1.2 of the library, but also to cater for some cases not met (or not so easily met) by std::shared_ptr:</p>
<ol type="1">
<li>The <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">Cgu::SharedLockHandle</a> class takes its deleter as a template parameter, which means that typedefs can be used to enable handles for particular deleters to be easily created (and as mentioned, this library provides a number of pre-formed deleter functors and typedefs for them). With std::shared_ptr, custom deleters must be passed to the shared_ptr constructor on every occasion a shared_ptr is constructed to manage a new object (and they cannot be templated as a typedef).</li>
<li>Glib memory slices provide an efficient small object allocator (they are likely to be significantly more efficient than global operator new()/new[](), which generally hand off to malloc(), and whilst malloc() is good for large block allocations it is generally poor as a small object allocator). Internal <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">Cgu::SharedLockHandle</a> allocation using glib memory slices can be achieved by compiling the library with the --with-glib-memory-slices-no-compat configuration option.</li>
<li>If glib memory slices are not used (which do not throw), constructing a shared pointer for a new managed object (or calling <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> for a new managed object) might throw if internal allocation fails. Although by default the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">Cgu::SharedLockHandle</a> implementation will delete the new managed object in such a case, it also provides an alternative constructor and <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> method which instead enable the new object to be accessed via the thrown exception object so that user code can decide what to do; std::shared_ptr deletes the new object in every case.</li>
<li>A user can explicitly state whether the shared handle object is to have atomic increment and decrement-and-test with respect to the reference count so that the reference count is thread safe ('no' in the case of <a class="el" href="classCgu_1_1SharedHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore. ">Cgu::SharedHandle</a>, and 'yes' in the case of <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">Cgu::SharedLockHandle</a>). Using atomic functions is unnecessary if the managed object concerned is only addressed in one thread (and might cause unwanted cache flushing in certain circumstances). std::shared_ptr will generally always use atomic functions with respect to its reference count in a multi-threaded program.</li>
</ol>
<p>In favour of std::shared_ptr, it has an associated std::weak_ptr class, which <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">Cgu::SharedLockHandle</a> does not (there is a <a class="el" href="classCgu_1_1GobjWeakHandle.html" title="This is a handle for managing weak references to GObjects. ">Cgu::GobjWeakHandle</a> class, but that is cognate with <a class="el" href="classCgu_1_1GobjHandle.html" title="This is a handle for managing the reference count of GObjects. ">Cgu::GobjHandle</a> and is only usable with GObjects). In addition shared_ptr objects have some atomic store, load and exchange functions provided for them which enable concurrent modifications of the same instance of shared_ptr in different threads to have defined results.</p>
<p>If the library is compiled with the --with-glib-memory-slices-no-compat configuration option, as mentioned <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">Cgu::SharedLockHandle</a> constructs its reference counting internals using glib memory slices. Although it is safe in a multi-threaded program if glib &lt; 2.32 is installed to construct a static <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object in global namespace (that is, prior to g_thread_init() being called) by means of the default constructor and/or a pointer argument of NULL, it is not safe if constructed with a non-NULL pointer value. If glib &gt;= 2.32 is installed, global objects with memory slices are safe in all circumstances. (Having said that, it would be highly unusual to have global <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> objects.) </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a254ad1c94e68018d4fa1beacc0209665"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> </td>
          <td>(</td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>ptr</em> = <code>0</code>)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Constructor taking an unmanaged object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>The object which the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> is to manage (if any). </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This constructor will not throw if the 'ptr' argument has a NULL value (the default), otherwise it might throw std::bad_alloc if memory is exhausted and the system throws in that case. If such an exception is thrown, this constructor is exception safe (it does not leak resources), but as well as cleaning itself up this constructor will also delete the managed object passed to it to avoid a memory leak. If such automatic deletion is not wanted in that case, use the version of this constructor taking a <a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165b">Cgu::SharedHandleAllocFail::Leave</a> tag argument. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>1. std::bad_alloc will not be thrown if the library has been installed using the --with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system. </dd>
<dd>
2. By default, glib atomic functions are used to provide thread-safe manipulation of the reference count. However, the header file <a class="el" href="shared__handle_8h.html">shared_handle.h</a> can be textually amended before the library is compiled to define the symbol CGU_SHARED_LOCK_HANDLE_USE_MUTEX so as to use mutexes instead, which might be useful for some debugging purposes. Were that to be done, <a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a> might be thrown by this constructor if initialization of the mutex fails. </dd></dl>

</div>
</div>
<a class="anchor" id="af3f909be6e779051cdbbaedf7617d4c0"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> </td>
          <td>(</td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165b">Cgu::SharedHandleAllocFail::Leave</a>&#160;</td>
          <td class="paramname"><em>tag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Constructor taking an unmanaged object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>The object which the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> is to manage. </td></tr>
    <tr><td class="paramname">tag</td><td>Passing the tag emumerator <a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165ba06b3691e0b5b46d8d138c67a100397a5">Cgu::SharedHandleAllocFail::leave</a> causes this constructor not to delete the new managed object passed as the 'ptr' argument in the event of internal allocation in this method failing because of memory exhaustion (in that event, <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> will be thrown). </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a></td><td>This constructor might throw <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> if memory is exhausted and the system would otherwise throw std::bad_alloc in that case. This constructor is exception safe (it does not leak resources), and if such an exception is thrown it will clean itself up, but it will not attempt to delete the new managed object passed to it. Access to the object passed to the 'ptr' argument can be obtained via the thrown <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> object. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>1. On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, so in those cases this version of the constructor will not be useful. </dd>
<dd>
2. If the library has been installed using the --with-glib-memory-slices-no-compat configuration option this version of the constructor will also not be useful: instead glib will terminate the program if it is unable to obtain memory from the operating system. </dd>
<dd>
3. By default, glib atomic functions are used to provide thread-safe manipulation of the reference count. However, the header file <a class="el" href="shared__handle_8h.html">shared_handle.h</a> can be textually amended before the library is compiled to define the symbol CGU_SHARED_LOCK_HANDLE_USE_MUTEX so as to use mutexes instead, which might be useful for some debugging purposes. Were that to be done, <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> might be thrown by this constructor if initialization of the mutex fails (even if the --with-glib-memory-slices-no-compat configuration option is chosen). </dd></dl>

</div>
</div>
<a class="anchor" id="a48e7c3d7fc7736208cf716dda585de82"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a>&lt; T, Dealloc &gt; &amp;&#160;</td>
          <td class="paramname"><em>sh_hand</em>)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The copy constructor does not throw. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sh_hand</td><td>The handle to be copied. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ae4aa6e9ddffab4af9ace68c41b790073"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a>&lt; T, Dealloc &gt; &amp;&amp;&#160;</td>
          <td class="paramname"><em>sh_hand</em>)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The move constructor does not throw. It has move semantics. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sh_hand</td><td>The handle to be moved. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="abd3141dcb093eb4ecca2bc258f6695cc"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::~<a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a> </td>
          <td>(</td>
          <td class="paramname">)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The destructor does not throw unless the destructor of a handled object throws - that should never happen. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ac3c1d1f41e275bf021055ceac2419592"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::get </td>
          <td>(</td>
          <td class="paramname">)</td><td></td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This method does not throw. </p>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the handled object (or NULL if none is handled). </dd></dl>

</div>
</div>
<a class="anchor" id="aacfb662d60523040da18768c3bb21e08"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int <a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::get_refcount </td>
          <td>(</td>
          <td class="paramname">)</td><td></td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This method does not throw. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> objects referencing the managed object (or 0 if none is managed by this <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a>). </dd></dl>
<dl class="section note"><dt>Note</dt><dd>The return value may not be valid if another thread has changed the reference count before the value returned by this method is acted on. It is provided as a utility, but may not be meaningful, depending on the intended usage. </dd></dl>

</div>
</div>
<a class="anchor" id="a56e539f82122df951b30062a3cd1ed24"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::operator T </td>
          <td>(</td>
          <td class="paramname">)</td><td></td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This method does not throw. </p>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the handled object (or NULL if none is handled). </dd></dl>

</div>
</div>
<a class="anchor" id="a6518142e137af1200fb1b16f173faf12"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a>&amp; <a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::operator= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCgu_1_1SharedLockHandle.html">SharedLockHandle</a>&lt; T, Dealloc &gt;&#160;</td>
          <td class="paramname"><em>sh_hand</em>)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This method (and so copy or move assignment) does not throw unless the destructor of a managed object throws. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sh_hand</td><td>the assignor. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object after assignment. </dd></dl>

</div>
</div>
<a class="anchor" id="aef2d14ba2181d36db0cecd59e312b153"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::reset </td>
          <td>(</td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>ptr</em> = <code>0</code>)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Causes the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> to cease to manage its managed object (if any), deleting it if this is the last ShareLockHandle object managing it. If the argument passed is not NULL, the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object will manage the new object passed (which must not be managed by any other <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>NULL (the default), or a new unmanaged object to manage. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This method will not throw if the 'ptr' argument has a NULL value (the default) and the destructor of a managed object does not throw, otherwise it might throw std::bad_alloc if memory is exhausted and the system throws in that case. Note that if such an exception is thrown then this method will do nothing (it is strongly exception safe and will continue to manage the object it was managing prior to the call), except that it will delete the new managed object passed to it to avoid a memory leak. If such automatic deletion in the event of such an exception is not wanted, use the <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> method taking a <a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165b">Cgu::SharedHandleAllocFail::Leave</a> tag type as its second argument. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>1. std::bad_alloc will not be thrown if the library has been installed using the --with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system. </dd>
<dd>
2. By default, glib atomic functions are used to provide thread-safe manipulation of the reference count. However, the header file <a class="el" href="shared__handle_8h.html">shared_handle.h</a> can be textually amended before the library is compiled to define the symbol CGU_SHARED_LOCK_HANDLE_USE_MUTEX so as to use mutexes instead, which might be useful for some debugging purposes. Were that to be done, <a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a> might be thrown by this method if initialization of the mutex fails. </dd>
<dd>
3. A <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object protects its reference count but not the managed object or its other internals. The <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> method should not be called by one thread in respect of a particular <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object while another thread may be operating on, copying or dereferencing the same instance of <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a>. It is thread-safe as against another instance of <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> managing the same object. </dd></dl>

</div>
</div>
<a class="anchor" id="acb8c88abc488e201ee1f63c8365a18a2"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T, class Dealloc = StandardArrayDelete&lt;T&gt;&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classCgu_1_1SharedLockHandle.html">Cgu::SharedLockHandle</a>&lt; T, Dealloc &gt;::reset </td>
          <td>(</td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165b">Cgu::SharedHandleAllocFail::Leave</a>&#160;</td>
          <td class="paramname"><em>tag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Causes the <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> to cease to manage its managed object (if any), deleting it if this is the last ShareLockHandle object managing it. The <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object will manage the new object passed (which must not be managed by any other <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object). This method is exception safe, but see the comments below on <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>A new unmanaged object to manage (if no new object is to be managed, use the version of <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> taking a default value of NULL). </td></tr>
    <tr><td class="paramname">tag</td><td>Passing the tag emumerator <a class="el" href="namespaceCgu_1_1SharedHandleAllocFail.html#af5c4cd2e39804471ea3862a1dd18165ba06b3691e0b5b46d8d138c67a100397a5">Cgu::SharedHandleAllocFail::leave</a> causes this method not to delete the new managed object passed as the 'ptr' argument in the event of internal allocation in this method failing because of memory exhaustion (in that event, <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> will be thrown). </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a></td><td>This method might throw <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> if memory is exhausted and the system would otherwise throw std::bad_alloc in that case. Note that if such an exception is thrown then this method will do nothing (it is strongly exception safe and will continue to manage the object it was managing prior to the call), and it will not attempt to delete the new managed object passed to it (if any). Access to the object passed to the 'ptr' argument can be obtained via the thrown <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> object. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>1. A <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object protects its reference count but not the managed object or its other internals. The <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> method should not be called by one thread in respect of a particular <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> object while another thread may be operating on, copying or dereferencing the same instance of <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a>. It is thread-safe as against another instance of <a class="el" href="classCgu_1_1SharedLockHandle.html" title="This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. ">SharedLockHandle</a> managing the same object. </dd>
<dd>
2. On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, so in those cases this version of the <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> method will not be useful. </dd>
<dd>
3. If the library has been installed using the --with-glib-memory-slices-no-compat configuration option this version of the <a class="el" href="classCgu_1_1SharedLockHandle.html#aef2d14ba2181d36db0cecd59e312b153">reset()</a> method will also not be useful: instead glib will terminate the program if it is unable to obtain memory from the operating system. </dd>
<dd>
4. By default, glib atomic functions are used to provide thread-safe manipulation of the reference count. However, the header file <a class="el" href="shared__handle_8h.html">shared_handle.h</a> can be textually amended before the library is compiled to define the symbol CGU_SHARED_LOCK_HANDLE_USE_MUTEX so as to use mutexes instead, which might be useful for some debugging purposes. Were that to be done, <a class="el" href="structCgu_1_1SharedHandleError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">Cgu::SharedHandleError</a> might be thrown by this method if initialization of the mutex fails (even if the --with-glib-memory-slices-no-compat configuration option is chosen). </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="shared__handle_8h_source.html">shared_handle.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 16 2013 20:45:31 for c++-gtk-utils by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.4
</small></address>
</body>
</html>