summaryrefslogtreecommitdiff
path: root/kern/timer.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-08-31 23:17:47 +0200
committerRichard Braun <rbraun@sceen.net>2017-08-31 23:17:47 +0200
commitb9ec5cca6f6e3fd571b2e534d36e2498e488164c (patch)
treeeb3053068ba3451e41d655f883a9fcee8efff238 /kern/timer.c
parent4e0b9efa25b58f7fcaf485349f66bd694390080a (diff)
kern/timer: improve access synchronization
Diffstat (limited to 'kern/timer.c')
-rw-r--r--kern/timer.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/kern/timer.c b/kern/timer.c
index 365b2fa4..ba148d5f 100644
--- a/kern/timer.c
+++ b/kern/timer.c
@@ -76,9 +76,6 @@ struct timer_bucket {
* The hash table bucket matching the last time member has already been
* processed, and the next periodic event resumes from the next bucket.
*
- * The cpu member is used to determine which lock serializes access to
- * the structure. It must be accessed atomically.
- *
* Locking order: interrupts -> timer_cpu_data.
*/
struct timer_cpu_data {
@@ -242,13 +239,13 @@ timer_set_canceled(struct timer *timer)
static void
timer_set_time(struct timer *timer, uint64_t ticks)
{
- timer->ticks = ticks;
+ atomic_store(&timer->ticks, ticks, ATOMIC_RELAXED);
}
static bool
timer_occurred(const struct timer *timer, uint64_t ref)
{
- return clock_time_occurred(timer->ticks, ref);
+ return clock_time_occurred(timer_get_time(timer), ref);
}
static uintptr_t