Commit Briefs

Omar Polo

delete trailing whitespace


Omar Polo

ev: add explicit check

min can't possibly be un-initialized, since poll(2) returns zero only when the timeout expires. However, this should please some checkers (looking at you, fortify/string.h!) and doesn't cost anything.


Omar Polo

ev: style tweak for cancel_timer()

in case i == base->ntimers bubbledown() won't do anything, but it's still better to pass an index that we know is valid.


Omar Polo

ev: protect from timers that delete themselves

delete the timer before running the callback: code in net.c may end up deleting the current timer from the timer' callback.


Omar Polo

ev: switch to poll(2)

ppoll(2) may not be available and we don't really need sub-millisecond precision.


Omar Polo

ev: simplify heap management

make ev_timer always use the ``reserve'' space and heapify at the start of the event loop tick. Bonus points for using the better algorithm and remove the unused bubbleup.



Omar Polo

ev: fix/improve cancel_timer and ev_timer_cancel

we only reach cancel_timer() for timers in the hap, so delete the unreachable code, and improve what we have. When deleting from the reserve space, just move the last element in the place of the removed one, no need to move everything. It'll be heapified later anyway.


Omar Polo

ev: fix corruption in bubbledown

tmp is of the wrong size, so we memcpy the wrong values. fun.



Omar Polo

ev: fix registering timers from timers callbacks

We can't add items to the heap while we've iterating it, so we can't directly insert new times from a timer' callback. Instead, add them to a ``reserve'' space after the end of the heap, and merge them back inside the heap after all events have been processed.


Omar Polo

ev: fix invalid fd check


Omar Polo

ev: define EV_* constants instead of reusing POLL{IN,OUT}

Dissociate us a bit from poll(2) so that we may even run on top of something else, and also allows to provide specific values for signal (EV_SIGNAL) and timers (EV_TIMEOUT).


Omar Polo

import ev.[ch]

from syncparty and amused; locally tweaked to support an arbitrary number of timers.