summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/timer-wheel/timer-wheel.c10
-rw-r--r--contrib/timer-wheel/timer-wheel.h2
2 files changed, 9 insertions, 3 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,
diff --git a/contrib/timer-wheel/timer-wheel.h b/contrib/timer-wheel/timer-wheel.h
index c52f2fc9b9c..faa941a240b 100644
--- a/contrib/timer-wheel/timer-wheel.h
+++ b/contrib/timer-wheel/timer-wheel.h
@@ -66,7 +66,7 @@ struct gf_tw_timer_list {
struct tvec_base *gf_tw_init_timers ();
int gf_tw_cleanup_timers (struct tvec_base *);
void gf_tw_add_timer (struct tvec_base *, struct gf_tw_timer_list *);
-void gf_tw_del_timer (struct tvec_base *, struct gf_tw_timer_list *);
+int gf_tw_del_timer (struct tvec_base *, struct gf_tw_timer_list *);
int gf_tw_mod_timer_pending (struct tvec_base *,
struct gf_tw_timer_list *, unsigned long);