diff options
author | Richard Braun <rbraun@sceen.net> | 2013-04-03 21:00:00 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-04-03 21:00:00 +0200 |
commit | 5eeb61715143e5be78fc807a550939fcc5ec41be (patch) | |
tree | 88f5a2e83af80de63918ccc576c009e92d726492 | |
parent | 9ca509a21cdb2ee412b62ba264704ce0d7fda4c4 (diff) |
kern/spinlock: replace compare-and-swap with a simpler exchange
-rw-r--r-- | kern/spinlock_i.h | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/kern/spinlock_i.h b/kern/spinlock_i.h index e0d88ba9..f4d2578c 100644 --- a/kern/spinlock_i.h +++ b/kern/spinlock_i.h @@ -13,12 +13,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * - * This implementation relies on the availability of hardware compare-and-swap - * support. It means that almost all spinlock operations imply a full memory - * barrier. Users must not rely on this behaviour as it could change in the - * future. */ #ifndef _KERN_SPINLOCK_I_H @@ -38,7 +32,7 @@ struct spinlock { static inline int spinlock_tryacquire(struct spinlock *lock) { - return atomic_cas(&lock->locked, 0, 1); + return atomic_swap(&lock->locked, 1); } static inline void |