Current File : //usr/share/doc/dbus/api/group__DBusMemoryInternals.html
<!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"/>
<title>D-Bus: Memory allocation implementation details</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">D-Bus
   &#160;<span id="projectnumber">1.8.20</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <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="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">Memory allocation implementation details</div>  </div>
<div class="ingroups"><a class="el" href="group__DBusInternals.html">D-Bus secret internal implementation details</a></div></div><!--header-->
<div class="contents">

<p>internals of <a class="el" href="group__DBusMemory.html#gaf6e588659067a854c3cca7ebe8ae5084" title="Allocates the given number of bytes, as with standard malloc().">dbus_malloc()</a> etc.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structShutdownClosure.html">ShutdownClosure</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This struct represents a function to be called on shutdown.  <a href="structShutdownClosure.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga719c469fe616ee7148e826e6ebf3c3e4"></a><!-- doxytag: member="DBusMemoryInternals::ShutdownClosure" ref="ga719c469fe616ee7148e826e6ebf3c3e4" args="" -->
typedef struct <a class="el" href="structShutdownClosure.html">ShutdownClosure</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemoryInternals.html#ga719c469fe616ee7148e826e6ebf3c3e4">ShutdownClosure</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Represents a function to be called on shutdown. <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemoryInternals.html#ga8dc6d5dd0a0e7901ab793da7403ee734">_dbus_register_shutdown_func</a> (DBusShutdownFunction func, void *data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Register a cleanup function to be called exactly once the next time <a class="el" href="group__DBusMemory.html#ga01912903e39428872920d861ef565bac" title="Frees all memory allocated internally by libdbus and reverses the effects of dbus_threads_init().">dbus_shutdown()</a> is called.  <a href="#ga8dc6d5dd0a0e7901ab793da7403ee734"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gade7c064966b2e3f9004099337b40b0f4"></a><!-- doxytag: member="DBusMemoryInternals::_dbus_register_shutdown_func_unlocked" ref="gade7c064966b2e3f9004099337b40b0f4" args="(DBusShutdownFunction func, void *data)" -->
<a class="el" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>&#160;</td><td class="memItemRight" valign="bottom"><b>_dbus_register_shutdown_func_unlocked</b> (DBusShutdownFunction func, void *data)</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295">_dbus_current_generation</a> = 1</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">_dbus_current_generation is used to track each time that <a class="el" href="group__DBusMemory.html#ga01912903e39428872920d861ef565bac" title="Frees all memory allocated internally by libdbus and reverses the effects of dbus_threads_init().">dbus_shutdown()</a> is called, so we can reinit things after it's been called.  <a href="#ga7c224d82013e2bdc181c1d85dcb6f295"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>internals of <a class="el" href="group__DBusMemory.html#gaf6e588659067a854c3cca7ebe8ae5084" title="Allocates the given number of bytes, as with standard malloc().">dbus_malloc()</a> etc. </p>
<p>Implementation details related to allocating and releasing blocks of memory. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga8dc6d5dd0a0e7901ab793da7403ee734"></a><!-- doxytag: member="dbus&#45;memory.c::_dbus_register_shutdown_func" ref="ga8dc6d5dd0a0e7901ab793da7403ee734" args="(DBusShutdownFunction func, void *data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> <a class="el" href="group__DBusMemoryInternals.html#ga8dc6d5dd0a0e7901ab793da7403ee734">_dbus_register_shutdown_func</a> </td>
          <td>(</td>
          <td class="paramtype">DBusShutdownFunction&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Register a cleanup function to be called exactly once the next time <a class="el" href="group__DBusMemory.html#ga01912903e39428872920d861ef565bac" title="Frees all memory allocated internally by libdbus and reverses the effects of dbus_threads_init().">dbus_shutdown()</a> is called. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">func</td><td>the function </td></tr>
    <tr><td class="paramname">data</td><td>data to pass to the function </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a> on not enough memory </dd></dl>

<p>Definition at line <a class="el" href="dbus-memory_8c_source.html#l00810">810</a> of file <a class="el" href="dbus-memory_8c_source.html">dbus-memory.c</a>.</p>

<p>References <a class="el" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1">FALSE</a>.</p>

</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="ga7c224d82013e2bdc181c1d85dcb6f295"></a><!-- doxytag: member="dbus&#45;memory.c::_dbus_current_generation" ref="ga7c224d82013e2bdc181c1d85dcb6f295" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295">_dbus_current_generation</a> = 1</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>_dbus_current_generation is used to track each time that <a class="el" href="group__DBusMemory.html#ga01912903e39428872920d861ef565bac" title="Frees all memory allocated internally by libdbus and reverses the effects of dbus_threads_init().">dbus_shutdown()</a> is called, so we can reinit things after it's been called. </p>
<p>It is simply incremented each time we shut down. </p>

<p>Definition at line <a class="el" href="dbus-memory_8c_source.html#l00781">781</a> of file <a class="el" href="dbus-memory_8c_source.html">dbus-memory.c</a>.</p>

<p>Referenced by <a class="el" href="dbus-connection_8c_source.html#l01948">_dbus_connection_close_possibly_shared()</a>, <a class="el" href="dbus-connection_8c_source.html#l01249">_dbus_connection_new_for_transport()</a>, <a class="el" href="dbus-connection_8c_source.html#l01419">_dbus_connection_ref_unlocked()</a>, <a class="el" href="dbus-internals_8c_source.html#l00854">_dbus_get_local_machine_uuid_encoded()</a>, <a class="el" href="dbus-connection_8c_source.html#l02932">dbus_connection_close()</a>, <a class="el" href="dbus-connection_8c_source.html#l02681">dbus_connection_ref()</a>, <a class="el" href="dbus-connection_8c_source.html#l02817">dbus_connection_unref()</a>, <a class="el" href="dbus-message_8c_source.html#l01667">dbus_message_ref()</a>, <a class="el" href="dbus-message_8c_source.html#l01690">dbus_message_unref()</a>, and <a class="el" href="dbus-threads_8c_source.html#l00391">dbus_threads_init()</a>.</p>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Thu Mar 3 2016 17:50:33 for D-Bus by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>