diff options
author | Richard Braun <rbraun@sceen.net> | 2013-04-03 20:58:54 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-04-03 20:58:54 +0200 |
commit | 9ca509a21cdb2ee412b62ba264704ce0d7fda4c4 (patch) | |
tree | c686e8792ce70ada2694af958696c11008389bba /kern/spinlock_i.h | |
parent | 5f0401fd56a2dc980def9c381a8248a5b61c45a9 (diff) |
kern/spinlock: change the interface of trylock functions
Make trylock functions behave as error-returning functions.
Diffstat (limited to 'kern/spinlock_i.h')
-rw-r--r-- | kern/spinlock_i.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kern/spinlock_i.h b/kern/spinlock_i.h index 58af6bf1..e0d88ba9 100644 --- a/kern/spinlock_i.h +++ b/kern/spinlock_i.h @@ -33,18 +33,18 @@ struct spinlock { }; /* - * Return true if acquired, false if busy. + * Return 0 on success, 1 if busy. */ static inline int spinlock_tryacquire(struct spinlock *lock) { - return !atomic_cas(&lock->locked, 0, 1); + return atomic_cas(&lock->locked, 0, 1); } static inline void spinlock_acquire(struct spinlock *lock) { - while (!spinlock_tryacquire(lock)) + while (spinlock_tryacquire(lock)) cpu_pause(); } |