Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 1 year ago
parent
commit
9c2c08ed07
2 changed files with 22 additions and 1 deletions
  1. +1
    -0
      Changes
  2. +21
    -1
      ev.pod

+ 1
- 0
Changes View File

@ -1,6 +1,7 @@
Revision history for libev, a high-performance and full-featured event loop.
- removed redundant 0-ptr check in ev_once.
- updated/extended ev_set_allocator documentation.
4.25 Fri Dec 21 07:49:20 CET 2018
- INCOMPATIBLE CHANGE: EV_THROW was renamed to EV_NOEXCEPT


+ 21
- 1
ev.pod View File

@ -267,12 +267,32 @@ You could override this function in high-availability programs to, say,
free some memory if it cannot allocate memory, to use a special allocator,
or even to sleep a while and retry until some memory is available.
Example: The following is the C<realloc> function that libev itself uses
which should work with C<realloc> and C<free> functions of all kinds and
is probably a good basis for your own implementation.
static void *
ev_realloc_emul (void *ptr, long size) EV_NOEXCEPT
{
if (size)
return realloc (ptr, size);
free (ptr);
return 0;
}
Example: Replace the libev allocator with one that waits a bit and then
retries (example requires a standards-compliant C<realloc>).
retries.
static void *
persistent_realloc (void *ptr, size_t size)
{
if (!size)
{
free (ptr);
return 0;
}
for (;;)
{
void *newptr = realloc (ptr, size);


Loading…
Cancel
Save