ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.3
(Generate patch)

Comparing libev/ev.3 (file contents):
Revision 1.25 by root, Tue Nov 27 19:23:31 2007 UTC vs.
Revision 1.26 by root, Tue Nov 27 19:41:52 2007 UTC

240might be supported on the current system, you would need to look at 240might be supported on the current system, you would need to look at
241\&\f(CW\*(C`ev_embeddable_backends () & ev_supported_backends ()\*(C'\fR, likewise for 241\&\f(CW\*(C`ev_embeddable_backends () & ev_supported_backends ()\*(C'\fR, likewise for
242recommended ones. 242recommended ones.
243.Sp 243.Sp
244See the description of \f(CW\*(C`ev_embed\*(C'\fR watchers for more info. 244See the description of \f(CW\*(C`ev_embed\*(C'\fR watchers for more info.
245.IP "ev_set_allocator (void *(*cb)(void *ptr, long size))" 4 245.IP "ev_set_allocator (void *(*cb)(void *ptr, size_t size))" 4
246.IX Item "ev_set_allocator (void *(*cb)(void *ptr, long size))" 246.IX Item "ev_set_allocator (void *(*cb)(void *ptr, size_t size))"
247Sets the allocation function to use (the prototype is similar to the 247Sets the allocation function to use (the prototype and semantics are
248realloc C function, the semantics are identical). It is used to allocate 248identical to the realloc C function). It is used to allocate and free
249and free memory (no surprises here). If it returns zero when memory 249memory (no surprises here). If it returns zero when memory needs to be
250needs to be allocated, the library might abort or take some potentially 250allocated, the library might abort or take some potentially destructive
251destructive action. The default is your system realloc function. 251action. The default is your system realloc function.
252.Sp 252.Sp
253You could override this function in high-availability programs to, say, 253You could override this function in high-availability programs to, say,
254free some memory if it cannot allocate memory, to use a special allocator, 254free some memory if it cannot allocate memory, to use a special allocator,
255or even to sleep a while and retry until some memory is available. 255or even to sleep a while and retry until some memory is available.
256.Sp 256.Sp
257Example: replace the libev allocator with one that waits a bit and then 257Example: replace the libev allocator with one that waits a bit and then
258retries: better than mine). 258retries: better than mine).
259.Sp 259.Sp
260.Vb 6 260.Vb 6
261\& static void * 261\& static void *
262\& persistent_realloc (void *ptr, long size) 262\& persistent_realloc (void *ptr, size_t size)
263\& { 263\& {
264\& for (;;) 264\& for (;;)
265\& { 265\& {
266\& void *newptr = realloc (ptr, size); 266\& void *newptr = realloc (ptr, size);
267.Ve 267.Ve

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines