diff options
-rw-r--r-- | kern/timer.c | 2 | ||||
-rw-r--r-- | kern/timer.h | 6 | ||||
-rw-r--r-- | kern/timer_i.h | 17 |
3 files changed, 11 insertions, 14 deletions
diff --git a/kern/timer.c b/kern/timer.c index ba148d5f..77a6bb36 100644 --- a/kern/timer.c +++ b/kern/timer.c @@ -239,7 +239,7 @@ timer_set_canceled(struct timer *timer) static void timer_set_time(struct timer *timer, uint64_t ticks) { - atomic_store(&timer->ticks, ticks, ATOMIC_RELAXED); + timer->ticks = ticks; } static bool diff --git a/kern/timer.h b/kern/timer.h index a082c538..ddace45e 100644 --- a/kern/timer.h +++ b/kern/timer.h @@ -23,7 +23,6 @@ #include <stdint.h> -#include <kern/atomic.h> #include <kern/init.h> /* @@ -44,11 +43,14 @@ typedef void (*timer_fn_t)(struct timer *); /* * Return the absolute expiration time of the timer, in ticks. + * + * This function may not be called while another thread is scheduling the + * timer. */ static inline uint64_t timer_get_time(const struct timer *timer) { - return atomic_load(&timer->ticks, ATOMIC_RELAXED); + return timer->ticks; } /* diff --git a/kern/timer_i.h b/kern/timer_i.h index 40e97f1b..bbe07f9b 100644 --- a/kern/timer_i.h +++ b/kern/timer_i.h @@ -29,12 +29,7 @@ * (c) cpu_data * (a) atomic * - * (*) The ticks member represents the expiration date. It may be read without - * locking the timer, in which case it must be accessed atomically. It - * may only be updated when the timer is locked though, so reads at such - * times don't need to be atomic. - * - * (**) The cpu member is used to determine which lock serializes access to + * (*) The cpu member is used to determine which lock serializes access to * the structure. It must be accessed atomically, but updated while the * timer is locked. */ @@ -44,12 +39,12 @@ struct timer { struct work work; }; - uint64_t ticks; /* (c,a,*) */ + uint64_t ticks; /* (c) */ timer_fn_t fn; - unsigned int cpu; /* (c,a,**) */ - unsigned short state; /* (c) */ - unsigned short flags; /* (c) */ - struct thread *joiner; /* (c) */ + unsigned int cpu; /* (c,a,*) */ + unsigned short state; /* (c) */ + unsigned short flags; /* (c) */ + struct thread *joiner; /* (c) */ }; #endif /* _KERN_TIMER_I_H */ |