Permalink
Browse files

timer: add stop()

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information...
felipec committed Feb 8, 2010
1 parent 5444e7e commit 69924a7ef015a0d6c4f605b2a05f6a7448a592b1
Showing with 9 additions and 1 deletion.
  1. +9 −1 pn_timer.h
View
@@ -65,7 +65,8 @@ pn_timer_start(struct pn_timer *timer,
static inline void
pn_timer_restart(struct pn_timer *timer)
{
- g_source_remove(timer->id);
+ if (timer->id)
+ g_source_remove(timer->id);
timer->id = g_timeout_add_seconds(timer->interval,
timer->function,
timer->data);
@@ -77,4 +78,11 @@ pn_timer_cancel(struct pn_timer *timer)
timer->id = 0;
}
+static inline void
+pn_timer_stop(struct pn_timer *timer)
+{
+ g_source_remove(timer->id);
+ timer->id = 0;
+}
+
#endif /* PN_TIMER_H */

0 comments on commit 69924a7

Please sign in to comment.