s3-events: make the old timed events compatible with tevent
commit72eab0330322677e773ea8d5ecc4ba23ab8b3257
authorAndrew Tridgell <tridge@samba.org>
Sat, 6 Feb 2010 03:14:45 +0000 (5 19:14 -0800)
committerKarolin Seeger <kseeger@samba.org>
Thu, 1 Apr 2010 07:39:12 +0000 (1 09:39 +0200)
tree38065e48fb3a686e81ef6426e8b723d3f62cf5a2
parent9ebd3b5ae08a7afa7a3a168f65cc8a8a4ef8457c
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.
(cherry picked from commit 5dbf175c75bd6139f3238f36665000641f7f7f79)
(cherry picked from commit 380e86e0f9c9314f4f69528227668dbbb222b144)
source3/lib/events.c