1179:ca4c6f590a08 | 1180:4c3a69b9723a |
---|---|
78 /** | 78 /** |
79 * Deallocates a memory pool and frees the managed memory. | 79 * Deallocates a memory pool and frees the managed memory. |
80 * | 80 * |
81 * @param pool the memory pool to free | 81 * @param pool the memory pool to free |
82 */ | 82 */ |
83 cx_attr_export | |
83 void cxMempoolFree(CxMempool *pool); | 84 void cxMempoolFree(CxMempool *pool); |
84 | 85 |
85 /** | 86 /** |
86 * Creates an array-based memory pool with a shared destructor function. | 87 * Creates an array-based memory pool with a shared destructor function. |
87 * | 88 * |
92 * @return the created memory pool or @c NULL if allocation failed | 93 * @return the created memory pool or @c NULL if allocation failed |
93 */ | 94 */ |
94 cx_attr_nodiscard | 95 cx_attr_nodiscard |
95 cx_attr_malloc | 96 cx_attr_malloc |
96 cx_attr_dealloc(cxMempoolFree, 1) | 97 cx_attr_dealloc(cxMempoolFree, 1) |
98 cx_attr_export | |
97 CxMempool *cxMempoolCreate(size_t capacity, cx_destructor_func destr); | 99 CxMempool *cxMempoolCreate(size_t capacity, cx_destructor_func destr); |
98 | 100 |
99 /** | 101 /** |
100 * Creates a basic array-based memory pool. | 102 * Creates a basic array-based memory pool. |
101 * | 103 * |
112 * | 114 * |
113 * @param memory the object allocated in the pool | 115 * @param memory the object allocated in the pool |
114 * @param fnc the destructor function | 116 * @param fnc the destructor function |
115 */ | 117 */ |
116 cx_attr_nonnull | 118 cx_attr_nonnull |
119 cx_attr_export | |
117 void cxMempoolSetDestructor( | 120 void cxMempoolSetDestructor( |
118 void *memory, | 121 void *memory, |
119 cx_destructor_func fnc | 122 cx_destructor_func fnc |
120 ); | 123 ); |
121 | 124 |
126 * The destructor MUST NOT free the memory. | 129 * The destructor MUST NOT free the memory. |
127 * | 130 * |
128 * @param memory the object allocated in the pool | 131 * @param memory the object allocated in the pool |
129 */ | 132 */ |
130 cx_attr_nonnull | 133 cx_attr_nonnull |
134 cx_attr_export | |
131 void cxMempoolRemoveDestructor(void *memory); | 135 void cxMempoolRemoveDestructor(void *memory); |
132 | 136 |
133 /** | 137 /** |
134 * Registers foreign memory with this pool. | 138 * Registers foreign memory with this pool. |
135 * | 139 * |
143 * @param destr the destructor function | 147 * @param destr the destructor function |
144 * @retval zero success | 148 * @retval zero success |
145 * @retval non-zero failure | 149 * @retval non-zero failure |
146 */ | 150 */ |
147 cx_attr_nonnull | 151 cx_attr_nonnull |
152 cx_attr_export | |
148 int cxMempoolRegister( | 153 int cxMempoolRegister( |
149 CxMempool *pool, | 154 CxMempool *pool, |
150 void *memory, | 155 void *memory, |
151 cx_destructor_func destr | 156 cx_destructor_func destr |
152 ); | 157 ); |