34 #endif |
34 #endif |
35 #include <inttypes.h> |
35 #include <inttypes.h> |
36 |
36 |
37 #include "mempool.h" |
37 #include "mempool.h" |
38 |
38 |
|
39 /** Capsule for destructible memory chunks. */ |
39 typedef struct { |
40 typedef struct { |
|
41 /** The destructor for the memory chunk. */ |
40 ucx_destructor destructor; |
42 ucx_destructor destructor; |
|
43 /** |
|
44 * First byte of the memory chunk. |
|
45 * Note, that the address <code>&c</code> is also the address |
|
46 * of the whole memory chunk. |
|
47 */ |
41 char c; |
48 char c; |
42 } ucx_memchunk; |
49 } ucx_memchunk; |
43 |
50 |
|
51 /** Capsule for data and its destructor. */ |
44 typedef struct { |
52 typedef struct { |
|
53 /** The destructor for the data. */ |
45 ucx_destructor destructor; |
54 ucx_destructor destructor; |
|
55 /** A pointer to the data. */ |
46 void *ptr; |
56 void *ptr; |
47 } ucx_regdestr; |
57 } ucx_regdestr; |
48 |
58 |
49 UCX_EXTERN void ucx_mempool_shared_destr(void* ptr) { |
59 UCX_EXTERN void ucx_mempool_shared_destr(void* ptr) { |
50 ucx_regdestr *rd = (ucx_regdestr*)ptr; |
60 ucx_regdestr *rd = (ucx_regdestr*)ptr; |