]> granicus.if.org Git - libevent/commit
Bypass event_add when using event_base_once() for a 0-sec timeout
authorNick Mathewson <nickm@torproject.org>
Wed, 7 Dec 2011 16:49:52 +0000 (11:49 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 7 Dec 2011 16:49:52 +0000 (11:49 -0500)
commit35c5c9558a70f3108ac0eb5955cad571ea356245
treeb139501e15154bf70638566e78daada6b787eae7
parent748a0d27948c8c7efd8c3b809a5d020ca1a9da35
Bypass event_add when using event_base_once() for a 0-sec timeout

Some people use event_base_once(EV_TIMEOUT) to make a callback get
called "immediately".  But this is pretty roundabout: it uses the
timeout heap to immediately put the event onto the active queue, when
it could just use event_active.  Additionally, it can lead to
surprising re-ordering behavior.

This patch changes event_base_once so it bypasses event_add() and
called event_active() directly on a pure-timeout event with an empty
timeout.
event.c
test/regress.c