src/ucx/cx/allocator.h

changeset 490
d218607f5a7e
parent 438
22eca559aded
child 504
c094afcdfb27
equal deleted inserted replaced
489:921f83a8943f 490:d218607f5a7e
131 void *data, 131 void *data,
132 void *memory 132 void *memory
133 ) __attribute__((__nonnull__(2))); 133 ) __attribute__((__nonnull__(2)));
134 134
135 /** 135 /**
136 * Structure holding an advanced destructor function and the desired payload.
137 * Invocations of func should use data as first argument.
138 */
139 typedef struct {
140 /**
141 * A pointer to the data that SHALL be used to invoke func.
142 */
143 void *data;
144 /**
145 * A pointer to the function to invoke.
146 */
147 cx_destructor_func2 func;
148 } cx_advanced_destructor;
149
150 /**
151 * Specifies the type of destructor to use.
152 */
153 enum cx_destructor_type {
154 /**
155 * Do not use a destructor function.
156 */
157 CX_DESTRUCTOR_NONE,
158 /**
159 * Use a simple destructor.
160 * @see cx_destructor_func
161 */
162 CX_DESTRUCTOR_SIMPLE,
163 /**
164 * Use an advanced destructor.
165 * @see cx_advanced_destructor
166 */
167 CX_DESTRUCTOR_ADVANCED
168 };
169
170 /**
171 * Allocate \p n bytes of memory. 136 * Allocate \p n bytes of memory.
172 * 137 *
173 * @param allocator the allocator 138 * @param allocator the allocator
174 * @param n the number of bytes 139 * @param n the number of bytes
175 * @return a pointer to the allocated memory 140 * @return a pointer to the allocated memory

mercurial