mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
pool: do not inline function anymore to avoid conflicts with libxil
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
parent
39825a8034
commit
30b061d8b1
2 changed files with 25 additions and 18 deletions
|
@ -33,7 +33,6 @@ struct Pool {
|
|||
struct CQueue queue; /**< The queue which is used to keep track of free blocks */
|
||||
};
|
||||
|
||||
#define INLINE static inline __attribute__((unused))
|
||||
#define pool_buffer(p) ((char *) (p) + (p)->buffer_off)
|
||||
|
||||
/** Initiazlize a pool
|
||||
|
@ -56,29 +55,16 @@ int pool_destroy(struct Pool *p) __attribute__ ((warn_unused_result));
|
|||
* This number can be smaller than the requested \p cnt blocks
|
||||
* in case the pool currently holds less than \p cnt blocks.
|
||||
*/
|
||||
INLINE ssize_t pool_get_many(struct Pool *p, void *blocks[], size_t cnt)
|
||||
{
|
||||
return queue_pull_many(&p->queue, blocks, cnt);
|
||||
}
|
||||
ssize_t pool_get_many(struct Pool *p, void *blocks[], size_t cnt);
|
||||
|
||||
/** Push \p cnt values which are giving by the array values to the stack. */
|
||||
INLINE ssize_t pool_put_many(struct Pool *p, void *blocks[], size_t cnt)
|
||||
{
|
||||
return queue_push_many(&p->queue, blocks, cnt);
|
||||
}
|
||||
ssize_t pool_put_many(struct Pool *p, void *blocks[], size_t cnt);
|
||||
|
||||
/** Get a free memory block from pool. */
|
||||
INLINE void * pool_get(struct Pool *p)
|
||||
{
|
||||
void *ptr;
|
||||
return queue_pull(&p->queue, &ptr) == 1 ? ptr : nullptr;
|
||||
}
|
||||
void * pool_get(struct Pool *p);
|
||||
|
||||
/** Release a memory block back to the pool. */
|
||||
INLINE int pool_put(struct Pool *p, void *buf)
|
||||
{
|
||||
return queue_push(&p->queue, buf);
|
||||
}
|
||||
int pool_put(struct Pool *p, void *buf);
|
||||
|
||||
} /* namespace node */
|
||||
} /* namespace villas */
|
||||
|
|
21
lib/pool.cpp
21
lib/pool.cpp
|
@ -62,3 +62,24 @@ int villas::node::pool_destroy(struct Pool *p)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t villas::node::pool_get_many(struct Pool *p, void *blocks[], size_t cnt)
|
||||
{
|
||||
return queue_pull_many(&p->queue, blocks, cnt);
|
||||
}
|
||||
|
||||
ssize_t villas::node::pool_put_many(struct Pool *p, void *blocks[], size_t cnt)
|
||||
{
|
||||
return queue_push_many(&p->queue, blocks, cnt);
|
||||
}
|
||||
|
||||
void * villas::node::pool_get(struct Pool *p)
|
||||
{
|
||||
void *ptr;
|
||||
return queue_pull(&p->queue, &ptr) == 1 ? ptr : nullptr;
|
||||
}
|
||||
|
||||
int villas::node::pool_put(struct Pool *p, void *buf)
|
||||
{
|
||||
return queue_push(&p->queue, buf);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue