libguac
1.6.0
Toggle main menu visibility
Loading...
Searching...
No Matches
pool.h
Go to the documentation of this file.
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one
3
* or more contributor license agreements. See the NOTICE file
4
* distributed with this work for additional information
5
* regarding copyright ownership. The ASF licenses this file
6
* to you under the Apache License, Version 2.0 (the
7
* "License"); you may not use this file except in compliance
8
* with the License. You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing,
13
* software distributed under the License is distributed on an
14
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
* KIND, either express or implied. See the License for the
16
* specific language governing permissions and limitations
17
* under the License.
18
*/
19
20
#ifndef _GUAC_POOL_H
21
#define _GUAC_POOL_H
22
29
30
#include "
pool-types.h
"
31
32
#include <pthread.h>
33
34
struct
guac_pool
{
35
41
int
min_size
;
42
46
int
active
;
47
52
int
__next_value;
53
57
guac_pool_int
* __head;
58
62
guac_pool_int
* __tail;
63
67
pthread_mutex_t __lock;
68
69
};
70
71
struct
guac_pool_int
{
72
76
int
value
;
77
82
guac_pool_int
* __next;
83
84
};
85
94
guac_pool
*
guac_pool_alloc
(
int
size);
95
101
void
guac_pool_free
(
guac_pool
* pool);
102
116
int
guac_pool_next_int
(
guac_pool
* pool);
117
140
int
guac_pool_next_int_below
(
guac_pool
* pool,
int
limit);
141
167
int
guac_pool_next_int_below_or_die
(
guac_pool
* pool,
int
limit);
168
181
void
guac_pool_free_int
(
guac_pool
* pool,
int
value);
182
183
#endif
184
pool-types.h
Type definitions related to the guac_pool pool of unique integers.
guac_pool_next_int_below_or_die
int guac_pool_next_int_below_or_die(guac_pool *pool, int limit)
Returns the next available integer from the given guac_pool that is below the given limit.
guac_pool_alloc
guac_pool * guac_pool_alloc(int size)
Allocates a new guac_pool having the given minimum size.
guac_pool_free
void guac_pool_free(guac_pool *pool)
Frees the given guac_pool.
guac_pool_next_int
int guac_pool_next_int(guac_pool *pool)
Returns the next available integer from the given guac_pool.
guac_pool_free_int
void guac_pool_free_int(guac_pool *pool, int value)
Frees the given integer back into the given guac_pool.
guac_pool_next_int_below
int guac_pool_next_int_below(guac_pool *pool, int limit)
Returns the next available integer from the given guac_pool that is below the given limit.
guac_pool_int
Represents a single integer within a larger pool of integers.
Definition
pool.h:71
guac_pool_int::value
int value
The integer value of this pool entry.
Definition
pool.h:76
guac_pool
A pool of integers.
Definition
pool.h:34
guac_pool::min_size
int min_size
The minimum number of integers which must have been returned by guac_pool_next_int before previously-...
Definition
pool.h:41
guac_pool::active
int active
The number of integers currently in use.
Definition
pool.h:46
guacamole
pool.h
Generated by
1.17.0