Tue, 02 Oct 2012 11:18:47 +0200
added missing stddef includes
added no break comments
olaf@13 | 1 | /* |
olaf@13 | 2 | * |
olaf@13 | 3 | */ |
olaf@13 | 4 | |
olaf@13 | 5 | #ifndef MPOOL_H |
olaf@13 | 6 | #define MPOOL_H |
olaf@13 | 7 | |
universe@38 | 8 | #include <stddef.h> |
universe@38 | 9 | |
olaf@13 | 10 | #ifdef __cplusplus |
olaf@13 | 11 | extern "C" { |
olaf@13 | 12 | #endif |
olaf@13 | 13 | |
olaf@13 | 14 | typedef void(*ucx_destructor)(void*); |
olaf@13 | 15 | |
olaf@13 | 16 | typedef struct { |
olaf@13 | 17 | void **data; |
olaf@13 | 18 | size_t ndata; |
olaf@13 | 19 | size_t size; |
olaf@13 | 20 | } UcxMempool; |
olaf@13 | 21 | |
olaf@13 | 22 | #define ucx_mempool_new_default() ucx_mempool_new(16) |
olaf@13 | 23 | UcxMempool *ucx_mempool_new(size_t n); |
universe@15 | 24 | int ucx_mempool_chcap(UcxMempool *pool, size_t newcap); |
olaf@13 | 25 | |
olaf@13 | 26 | void *ucx_mempool_malloc(UcxMempool *pool, size_t n); |
olaf@13 | 27 | void *ucx_mempool_calloc(UcxMempool *pool, size_t nelem, size_t elsize); |
olaf@13 | 28 | void *ucx_mempool_realloc(UcxMempool *pool, void *ptr, size_t n); |
olaf@13 | 29 | |
olaf@13 | 30 | void ucx_mempool_free(UcxMempool *pool); |
olaf@13 | 31 | |
olaf@13 | 32 | void ucx_mempool_set_destr(void *ptr, ucx_destructor func); |
olaf@13 | 33 | void ucx_mempool_reg_destr(UcxMempool *pool, void *ptr, ucx_destructor destr); |
olaf@13 | 34 | |
olaf@13 | 35 | |
olaf@13 | 36 | #ifdef __cplusplus |
olaf@13 | 37 | } |
olaf@13 | 38 | #endif |
olaf@13 | 39 | |
olaf@13 | 40 | #endif /* MPOOL_H */ |
olaf@13 | 41 |