<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>libguac: guacamole/pool.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="projectalign" style="padding-left: 0.5em;"> <div id="projectname">libguac  <span id="projectnumber">1.3.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</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_6bb9fad85c98b48a11165f494b9f53ce.html">guacamole</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">pool.h</div> </div> </div><!--header--> <div class="contents"> <a href="pool_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"> * Licensed to the Apache Software Foundation (ASF) under one</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * or more contributor license agreements. See the NOTICE file</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * distributed with this work for additional information</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * regarding copyright ownership. The ASF licenses this file</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * to you under the Apache License, Version 2.0 (the</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * "License"); you may not use this file except in compliance</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * with the License. You may obtain a copy of the License at</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> *</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</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"> * Unless required by applicable law or agreed to in writing,</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * software distributed under the License is distributed on an</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * KIND, either express or implied. See the License for the</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * specific language governing permissions and limitations</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * under the License.</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> */</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#ifndef _GUAC_POOL_H</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#define _GUAC_POOL_H</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include "<a class="code" href="pool-types_8h.html">pool-types.h</a>"</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include <pthread.h></span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structguac__pool.html"> 34</a></span> <span class="keyword">struct </span><a class="code" href="structguac__pool.html">guac_pool</a> {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="structguac__pool.html#a71ed274c2481dbcd5e06bf7d8d74d71e"> 41</a></span>  <span class="keywordtype">int</span> <a class="code" href="structguac__pool.html#a71ed274c2481dbcd5e06bf7d8d74d71e">min_size</a>;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structguac__pool.html#ac22871d5c476ca9a6dd25a2446fa0fd3"> 46</a></span>  <span class="keywordtype">int</span> <a class="code" href="structguac__pool.html#ac22871d5c476ca9a6dd25a2446fa0fd3">active</a>;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordtype">int</span> __next_value;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <a class="code" href="structguac__pool__int.html">guac_pool_int</a>* __head;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="code" href="structguac__pool__int.html">guac_pool_int</a>* __tail;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  pthread_mutex_t __lock;</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="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="structguac__pool__int.html"> 71</a></span> <span class="keyword">struct </span><a class="code" href="structguac__pool__int.html">guac_pool_int</a> {</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structguac__pool__int.html#af76ff5f21c6e0f69d95cdd1385ea24a4"> 76</a></span>  <span class="keywordtype">int</span> <a class="code" href="structguac__pool__int.html#af76ff5f21c6e0f69d95cdd1385ea24a4">value</a>;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <a class="code" href="structguac__pool__int.html">guac_pool_int</a>* __next;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> };</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> </div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <a class="code" href="structguac__pool.html">guac_pool</a>* <a class="code" href="pool_8h.html#a3e7589997fdd734a6d6155badebd042f">guac_pool_alloc</a>(<span class="keywordtype">int</span> size);</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="keywordtype">void</span> <a class="code" href="pool_8h.html#a7015e5939617ab7e55477ba0a4f85bdb">guac_pool_free</a>(<a class="code" href="structguac__pool.html">guac_pool</a>* pool);</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> <span class="keywordtype">int</span> <a class="code" href="pool_8h.html#abe3c79e0fec121e3d1b1d3ce37aa45f4">guac_pool_next_int</a>(<a class="code" href="structguac__pool.html">guac_pool</a>* pool);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span> </div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="keywordtype">void</span> <a class="code" href="pool_8h.html#ad90069a41689cf319f46af44bb113579">guac_pool_free_int</a>(<a class="code" href="structguac__pool.html">guac_pool</a>* pool, <span class="keywordtype">int</span> value);</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div><div class="ttc" id="pool_8h_html_abe3c79e0fec121e3d1b1d3ce37aa45f4"><div class="ttname"><a href="pool_8h.html#abe3c79e0fec121e3d1b1d3ce37aa45f4">guac_pool_next_int</a></div><div class="ttdeci">int guac_pool_next_int(guac_pool *pool)</div><div class="ttdoc">Returns the next available integer from the given guac_pool.</div></div> <div class="ttc" id="pool_8h_html_a3e7589997fdd734a6d6155badebd042f"><div class="ttname"><a href="pool_8h.html#a3e7589997fdd734a6d6155badebd042f">guac_pool_alloc</a></div><div class="ttdeci">guac_pool * guac_pool_alloc(int size)</div><div class="ttdoc">Allocates a new guac_pool having the given minimum size.</div></div> <div class="ttc" id="structguac__pool_html_a71ed274c2481dbcd5e06bf7d8d74d71e"><div class="ttname"><a href="structguac__pool.html#a71ed274c2481dbcd5e06bf7d8d74d71e">guac_pool::min_size</a></div><div class="ttdeci">int min_size</div><div class="ttdoc">The minimum number of integers which must have been returned by guac_pool_next_int before previously-...</div><div class="ttdef"><b>Definition:</b> pool.h:41</div></div> <div class="ttc" id="structguac__pool__int_html"><div class="ttname"><a href="structguac__pool__int.html">guac_pool_int</a></div><div class="ttdoc">Represents a single integer within a larger pool of integers.</div><div class="ttdef"><b>Definition:</b> pool.h:71</div></div> <div class="ttc" id="pool_8h_html_a7015e5939617ab7e55477ba0a4f85bdb"><div class="ttname"><a href="pool_8h.html#a7015e5939617ab7e55477ba0a4f85bdb">guac_pool_free</a></div><div class="ttdeci">void guac_pool_free(guac_pool *pool)</div><div class="ttdoc">Frees the given guac_pool.</div></div> <div class="ttc" id="structguac__pool_html_ac22871d5c476ca9a6dd25a2446fa0fd3"><div class="ttname"><a href="structguac__pool.html#ac22871d5c476ca9a6dd25a2446fa0fd3">guac_pool::active</a></div><div class="ttdeci">int active</div><div class="ttdoc">The number of integers currently in use.</div><div class="ttdef"><b>Definition:</b> pool.h:46</div></div> <div class="ttc" id="pool-types_8h_html"><div class="ttname"><a href="pool-types_8h.html">pool-types.h</a></div><div class="ttdoc">Type definitions related to the guac_pool pool of unique integers.</div></div> <div class="ttc" id="structguac__pool_html"><div class="ttname"><a href="structguac__pool.html">guac_pool</a></div><div class="ttdoc">A pool of integers.</div><div class="ttdef"><b>Definition:</b> pool.h:34</div></div> <div class="ttc" id="pool_8h_html_ad90069a41689cf319f46af44bb113579"><div class="ttname"><a href="pool_8h.html#ad90069a41689cf319f46af44bb113579">guac_pool_free_int</a></div><div class="ttdeci">void guac_pool_free_int(guac_pool *pool, int value)</div><div class="ttdoc">Frees the given integer back into the given guac_pool.</div></div> <div class="ttc" id="structguac__pool__int_html_af76ff5f21c6e0f69d95cdd1385ea24a4"><div class="ttname"><a href="structguac__pool__int.html#af76ff5f21c6e0f69d95cdd1385ea24a4">guac_pool_int::value</a></div><div class="ttdeci">int value</div><div class="ttdoc">The integer value of this pool entry.</div><div class="ttdef"><b>Definition:</b> pool.h:76</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.15 </small></address> </body> </html>