summaryrefslogtreecommitdiffstats
path: root/contrib/timer-wheel/timer-wheel.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/timer-wheel/timer-wheel.c')
-rw-r--r--contrib/timer-wheel/timer-wheel.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/timer-wheel/timer-wheel.c b/contrib/timer-wheel/timer-wheel.c
index d9b2ccdc68a..013c0f278a1 100644
--- a/contrib/timer-wheel/timer-wheel.c
+++ b/contrib/timer-wheel/timer-wheel.c
@@ -218,14 +218,20 @@ void gf_tw_add_timer (struct tvec_base *base, struct gf_tw_timer_list *timer)
/**
* Remove a timer from the timer wheel
*/
-void gf_tw_del_timer (struct tvec_base *base, struct gf_tw_timer_list *timer)
+int gf_tw_del_timer (struct tvec_base *base, struct gf_tw_timer_list *timer)
{
+ int ret = 0;
+
pthread_spin_lock (&base->lock);
{
- if (timer_pending (timer))
+ if (timer_pending (timer)) {
+ ret = 1;
__gf_tw_detach_timer (timer);
+ }
}
pthread_spin_unlock (&base->lock);
+
+ return ret;
}
int gf_tw_mod_timer_pending (struct tvec_base *base,