s3-events: make the old timed events compatible with tevent
authorAndrew Tridgell <tridge@samba.org>
Fri, 5 Feb 2010 03:25:03 +0000 (14:25 +1100)
committerMichael Adam <obnox@samba.org>
Fri, 12 Feb 2010 14:52:38 +0000 (15:52 +0100)
commit4610cb0764ba81a0339af60a2dbaeaf16e4713b7
tree47c03c1a508dc2a69cd787bfc2584a5dffdc2215
parent5b6b12894fb643d303cbfc4efb5c1d026e4cbd7d
s3-events: make the old timed events compatible with tevent

tevent ensures that a timed event is only called once. The old events
code relied on the called handler removing the event itself. If the
handler removed the event after calling a function which invoked the
event loop then the timed event could loop forever.

This change makes the two timed event systems more compatible, by
allowing the handler to free the te if it wants to, but ensuring it is
off the linked list of events before the handler is called, and
ensuring it is freed even if the handler doesn't free it.
source3/lib/events.c