summaryrefslogtreecommitdiff
path: root/kern/spinlock_i.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-01-03 23:54:23 +0100
committerRichard Braun <rbraun@sceen.net>2014-01-03 23:54:23 +0100
commitb53c5990ccc688e03d120c87940c7024eaca4813 (patch)
tree31f930608f9f140e6bccc8f2d5285cd3f1fb61f4 /kern/spinlock_i.h
parent99cef9617922016bda314a6e21b499e17e1af56e (diff)
Update calls to atomic operations
Make spin locks and mutexes encode their state on an int rather than a long.
Diffstat (limited to 'kern/spinlock_i.h')
-rw-r--r--kern/spinlock_i.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/kern/spinlock_i.h b/kern/spinlock_i.h
index f4d2578c..63018afa 100644
--- a/kern/spinlock_i.h
+++ b/kern/spinlock_i.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013 Richard Braun.
+ * Copyright (c) 2012-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
#include <machine/cpu.h>
struct spinlock {
- unsigned long locked;
+ unsigned int locked;
};
/*
@@ -32,7 +32,7 @@ struct spinlock {
static inline int
spinlock_tryacquire(struct spinlock *lock)
{
- return atomic_swap(&lock->locked, 1);
+ return atomic_swap_uint(&lock->locked, 1);
}
static inline void
@@ -45,9 +45,9 @@ spinlock_acquire(struct spinlock *lock)
static inline void
spinlock_release(struct spinlock *lock)
{
- unsigned long locked;
+ unsigned int locked;
- locked = atomic_swap(&lock->locked, 0);
+ locked = atomic_swap_uint(&lock->locked, 0);
assert(locked);
}