Fri, 20 Dec 2024 21:25:33 +0100
upgrade Doxyfile
<!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.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>ucx: /home/mike/workspace/c/ucx/src/ucx/mempool.h Source File</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="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.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 id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">ucx </div> <div id="projectbrief">UAP Common Extensions</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">mempool.h</div> </div> </div><!--header--> <div class="contents"> <a href="mempool_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * modification, are permitted provided that the following conditions are met:</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * notice, this list of conditions and the following disclaimer.</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * documentation and/or other materials provided with the distribution.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"> * POSSIBILITY OF SUCH DAMAGE.</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> */</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor">#ifndef UCX_MEMPOOL_H</span></div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#define UCX_MEMPOOL_H</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="preprocessor">#include "<a class="code" href="ucx_8h.html">ucx.h</a>"</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#include "<a class="code" href="allocator_8h.html">allocator.h</a>"</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor">#include <stddef.h></span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="structUcxMempool.html"> 52</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>{</div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="structUcxMempool.html#ac45fd1e9269399e4c434d6bdaa770d92"> 54</a></span>  <a class="code" href="structUcxAllocator.html">UcxAllocator</a> *<a class="code" href="structUcxMempool.html#ac45fd1e9269399e4c434d6bdaa770d92">allocator</a>;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  </div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structUcxMempool.html#ae98c1b0150bb119ee0a8506a6f310d6e"> 57</a></span>  <span class="keywordtype">void</span> **<a class="code" href="structUcxMempool.html#ae98c1b0150bb119ee0a8506a6f310d6e">data</a>;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  </div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="structUcxMempool.html#aa3a73ab231e1bc207d526f46f1c1e23a"> 60</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structUcxMempool.html#aa3a73ab231e1bc207d526f46f1c1e23a">ndata</a>;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  </div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="structUcxMempool.html#a304729986f2894971d0469e71e196bf0"> 63</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structUcxMempool.html#a304729986f2894971d0469e71e196bf0">size</a>;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> } <a class="code" href="structUcxMempool.html">UcxMempool</a>;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="mempool_8h.html#a49f7bd1da5ac201d0cf54dc0f0d82dd2"> 67</a></span> <span class="preprocessor">#define ucx_mempool_new_default() ucx_mempool_new(16)</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <a class="code" href="structUcxMempool.html">UcxMempool</a> *<a class="code" href="mempool_8h.html#ad71cb8c3b6fdb30360376a8b372ef22a">ucx_mempool_new</a>(<span class="keywordtype">size_t</span> n);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> </div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">int</span> <a class="code" href="mempool_8h.html#aaf75b5016098723a9280531ccc3a6d77">ucx_mempool_chcap</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool, <span class="keywordtype">size_t</span> newcap);</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">void</span> *<a class="code" href="mempool_8h.html#a2ae492b8f2878ccc9837ac213dced11e">ucx_mempool_malloc</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool, <span class="keywordtype">size_t</span> n);</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="keywordtype">void</span> *<a class="code" href="mempool_8h.html#a4b9142011824ae24f00fabe128417d69">ucx_mempool_calloc</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool, <span class="keywordtype">size_t</span> nelem, <span class="keywordtype">size_t</span> elsize);</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="keywordtype">void</span> *<a class="code" href="mempool_8h.html#a660ef42520ed6737c2e77aae18e3a7a4">ucx_mempool_realloc</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool, <span class="keywordtype">void</span> *ptr, <span class="keywordtype">size_t</span> n);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="keywordtype">void</span> <a class="code" href="mempool_8h.html#aefa26e3015f5aefadbfc74221bd246ac">ucx_mempool_free</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool, <span class="keywordtype">void</span> *ptr);</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> </div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> <span class="keywordtype">void</span> <a class="code" href="mempool_8h.html#af096378da7e9bfbed3088497cf4c15bf">ucx_mempool_destroy</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool);</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> </div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> <span class="keywordtype">void</span> <a class="code" href="mempool_8h.html#adb788e7ec24cd7dbdea6381539c549f2">ucx_mempool_set_destr</a>(<span class="keywordtype">void</span> *ptr, <a class="code" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a> func);</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> </div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> <span class="keywordtype">void</span> <a class="code" href="mempool_8h.html#af47b6b7c40f8f263dc28cc9a4e77b27c">ucx_mempool_reg_destr</a>(<a class="code" href="structUcxMempool.html">UcxMempool</a> *pool, <span class="keywordtype">void</span> *ptr, <a class="code" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a> destr);</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> </div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> }</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> </div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> <span class="preprocessor">#endif </span><span class="comment">/* UCX_MEMPOOL_H */</span><span class="preprocessor"></span></div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span> </div><div class="ttc" id="mempool_8h_html_aefa26e3015f5aefadbfc74221bd246ac"><div class="ttname"><a href="mempool_8h.html#aefa26e3015f5aefadbfc74221bd246ac">ucx_mempool_free</a></div><div class="ttdeci">void ucx_mempool_free(UcxMempool *pool, void *ptr)</div><div class="ttdoc">Frees pooled memory. </div><div class="ttdef"><b>Definition:</b> mempool.c:187</div></div> <div class="ttc" id="structUcxMempool_html"><div class="ttname"><a href="structUcxMempool.html">UcxMempool</a></div><div class="ttdoc">UCX mempool structure. </div><div class="ttdef"><b>Definition:</b> mempool.h:52</div></div> <div class="ttc" id="mempool_8h_html_af096378da7e9bfbed3088497cf4c15bf"><div class="ttname"><a href="mempool_8h.html#af096378da7e9bfbed3088497cf4c15bf">ucx_mempool_destroy</a></div><div class="ttdeci">void ucx_mempool_destroy(UcxMempool *pool)</div><div class="ttdoc">Destroys a memory pool. </div><div class="ttdef"><b>Definition:</b> mempool.c:209</div></div> <div class="ttc" id="ucx_8h_html"><div class="ttname"><a href="ucx_8h.html">ucx.h</a></div><div class="ttdoc">Main UCX Header providing most common definitions. </div></div> <div class="ttc" id="mempool_8h_html_aaf75b5016098723a9280531ccc3a6d77"><div class="ttname"><a href="mempool_8h.html#aaf75b5016098723a9280531ccc3a6d77">ucx_mempool_chcap</a></div><div class="ttdeci">int ucx_mempool_chcap(UcxMempool *pool, size_t newcap)</div><div class="ttdoc">Resizes a memory pool. </div><div class="ttdef"><b>Definition:</b> mempool.c:103</div></div> <div class="ttc" id="mempool_8h_html_af47b6b7c40f8f263dc28cc9a4e77b27c"><div class="ttname"><a href="mempool_8h.html#af47b6b7c40f8f263dc28cc9a4e77b27c">ucx_mempool_reg_destr</a></div><div class="ttdeci">void ucx_mempool_reg_destr(UcxMempool *pool, void *ptr, ucx_destructor destr)</div><div class="ttdoc">Registers a destructor function for the specified (non-pooled) memory. </div><div class="ttdef"><b>Definition:</b> mempool.c:229</div></div> <div class="ttc" id="mempool_8h_html_a2ae492b8f2878ccc9837ac213dced11e"><div class="ttname"><a href="mempool_8h.html#a2ae492b8f2878ccc9837ac213dced11e">ucx_mempool_malloc</a></div><div class="ttdeci">void * ucx_mempool_malloc(UcxMempool *pool, size_t n)</div><div class="ttdoc">Allocates pooled memory. </div><div class="ttdef"><b>Definition:</b> mempool.c:123</div></div> <div class="ttc" id="structUcxMempool_html_a304729986f2894971d0469e71e196bf0"><div class="ttname"><a href="structUcxMempool.html#a304729986f2894971d0469e71e196bf0">UcxMempool::size</a></div><div class="ttdeci">size_t size</div><div class="ttdoc">Memory pool size. </div><div class="ttdef"><b>Definition:</b> mempool.h:63</div></div> <div class="ttc" id="structUcxMempool_html_aa3a73ab231e1bc207d526f46f1c1e23a"><div class="ttname"><a href="structUcxMempool.html#aa3a73ab231e1bc207d526f46f1c1e23a">UcxMempool::ndata</a></div><div class="ttdeci">size_t ndata</div><div class="ttdoc">Count of pooled memory items. </div><div class="ttdef"><b>Definition:</b> mempool.h:60</div></div> <div class="ttc" id="structUcxAllocator_html"><div class="ttname"><a href="structUcxAllocator.html">UcxAllocator</a></div><div class="ttdoc">UCX allocator data structure containing memory management functions. </div><div class="ttdef"><b>Definition:</b> allocator.h:88</div></div> <div class="ttc" id="mempool_8h_html_a4b9142011824ae24f00fabe128417d69"><div class="ttname"><a href="mempool_8h.html#a4b9142011824ae24f00fabe128417d69">ucx_mempool_calloc</a></div><div class="ttdeci">void * ucx_mempool_calloc(UcxMempool *pool, size_t nelem, size_t elsize)</div><div class="ttdoc">Allocates a pooled memory array. </div><div class="ttdef"><b>Definition:</b> mempool.c:148</div></div> <div class="ttc" id="structUcxMempool_html_ae98c1b0150bb119ee0a8506a6f310d6e"><div class="ttname"><a href="structUcxMempool.html#ae98c1b0150bb119ee0a8506a6f310d6e">UcxMempool::data</a></div><div class="ttdeci">void ** data</div><div class="ttdoc">List of pointers to pooled memory. </div><div class="ttdef"><b>Definition:</b> mempool.h:57</div></div> <div class="ttc" id="mempool_8h_html_ad71cb8c3b6fdb30360376a8b372ef22a"><div class="ttname"><a href="mempool_8h.html#ad71cb8c3b6fdb30360376a8b372ef22a">ucx_mempool_new</a></div><div class="ttdeci">UcxMempool * ucx_mempool_new(size_t n)</div><div class="ttdoc">Creates a memory pool with the specified initial size. </div><div class="ttdef"><b>Definition:</b> mempool.c:67</div></div> <div class="ttc" id="mempool_8h_html_a660ef42520ed6737c2e77aae18e3a7a4"><div class="ttname"><a href="mempool_8h.html#a660ef42520ed6737c2e77aae18e3a7a4">ucx_mempool_realloc</a></div><div class="ttdeci">void * ucx_mempool_realloc(UcxMempool *pool, void *ptr, size_t n)</div><div class="ttdoc">Reallocates pooled memory. </div><div class="ttdef"><b>Definition:</b> mempool.c:162</div></div> <div class="ttc" id="allocator_8h_html"><div class="ttname"><a href="allocator_8h.html">allocator.h</a></div><div class="ttdoc">Allocator for custom memory management. </div></div> <div class="ttc" id="structUcxMempool_html_ac45fd1e9269399e4c434d6bdaa770d92"><div class="ttname"><a href="structUcxMempool.html#ac45fd1e9269399e4c434d6bdaa770d92">UcxMempool::allocator</a></div><div class="ttdeci">UcxAllocator * allocator</div><div class="ttdoc">UcxAllocator based on this pool. </div><div class="ttdef"><b>Definition:</b> mempool.h:54</div></div> <div class="ttc" id="mempool_8h_html_adb788e7ec24cd7dbdea6381539c549f2"><div class="ttname"><a href="mempool_8h.html#adb788e7ec24cd7dbdea6381539c549f2">ucx_mempool_set_destr</a></div><div class="ttdeci">void ucx_mempool_set_destr(void *ptr, ucx_destructor func)</div><div class="ttdoc">Sets a destructor function for the specified memory. </div><div class="ttdef"><b>Definition:</b> mempool.c:225</div></div> <div class="ttc" id="ucx_8h_html_ad2b370c2809914c8b7fedab163c266b3"><div class="ttname"><a href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a></div><div class="ttdeci">void(* ucx_destructor)(void *)</div><div class="ttdoc">A function pointer to a destructor function. </div><div class="ttdef"><b>Definition:</b> ucx.h:72</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>