Convert scheduler flag to boolean
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Tue, 11 May 2010 11:38:15 +0000 (13:38 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Tue, 11 May 2010 11:38:15 +0000 (13:38 +0200)
src/scheduler.c
src/scheduler.h

index de255e0..f40ef25 100644 (file)
@@ -598,7 +598,7 @@ walk_timers(uint32_t * last_run)
         timer->timer_cb(timer->timer_cb_context);
 
         /* Only act on actually running timers */
-        if (timer->timer_flags & OLSR_TIMER_RUNNING) {
+        if (timer->timer_running) {
           /*
            * Don't restart the periodic timer if the callback function has
            * stopped the timer.
@@ -773,7 +773,7 @@ olsr_start_timer(unsigned int rel_time,
   timer->timer_cb = cb_func;
   timer->timer_cb_context = context;
   timer->timer_jitter_pct = jitter_pct;
-  timer->timer_flags = OLSR_TIMER_RUNNING;
+  timer->timer_running = true;
 
   /* The cookie is used for debugging to traceback the originator */
   timer->timer_cookie = ci;
@@ -817,7 +817,7 @@ olsr_stop_timer(struct timer_entry *timer)
    * Carve out of the existing wheel_slot and free.
    */
   list_remove(&timer->timer_list);
-  timer->timer_flags &= ~OLSR_TIMER_RUNNING;
+  timer->timer_running = false;
   olsr_cookie_usage_decr(timer->timer_cookie);
 
   olsr_cookie_free(timer_mem_cookie, timer);
index f0da787..42d5f2e 100644 (file)
@@ -71,7 +71,7 @@ struct timer_entry {
   unsigned int timer_period;           /* set for periodical timers (relative time) */
   struct olsr_cookie_info *timer_cookie;       /* used for diag stuff */
   uint8_t timer_jitter_pct;            /* the jitter expressed in percent */
-  uint8_t timer_flags;                 /* misc flags */
+  bool timer_running;                 /* misc flags */
   unsigned int timer_random;           /* cache random() result for performance reasons */
   timer_cb_func timer_cb;              /* callback function */
   void *timer_cb_context;              /* context pointer */
@@ -83,9 +83,6 @@ LISTNODE2STRUCT(list2timer, struct timer_entry, timer_list);
 #define OLSR_TIMER_ONESHOT    0 /* One shot timer */
 #define OLSR_TIMER_PERIODIC   1 /* Periodic timer */
 
-/* Timer flags */
-#define OLSR_TIMER_RUNNING  ( 1 << 0)   /* this timer is running */
-
 /* Timers */
 void olsr_init_timers(void);
 void olsr_flush_timers(void);