Use atomic_cas_ulong().

This commit is contained in:
ad 2007-12-09 15:32:27 +00:00
parent 56c1b0074f
commit 36fb43dbdb
2 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mutex.h,v 1.3 2007/11/21 10:19:09 yamt Exp $ */
/* $NetBSD: mutex.h,v 1.4 2007/12/09 15:32:27 ad Exp $ */
/*-
* Copyright (c) 2002, 2006 The NetBSD Foundation, Inc.
@ -73,9 +73,11 @@ struct kmutex {
*/
#define MUTEX_GIVE(mtx) /* nothing */
#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n))
#define MUTEX_CAS(p, o, n) \
(_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t);
unsigned long _atomic_cas_ulong(volatile unsigned long *,
unsigned long, unsigned long);
#endif /* __MUTEX_PRIVATE */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rwlock.h,v 1.3 2007/11/21 10:19:09 yamt Exp $ */
/* $NetBSD: rwlock.h,v 1.4 2007/12/09 15:32:27 ad Exp $ */
/*-
* Copyright (c) 2002, 2006 The NetBSD Foundation, Inc.
@ -58,9 +58,11 @@ struct krwlock {
*/
#define RW_GIVE(rw) /* nothing */
#define RW_CAS(p, o, n) _lock_cas((p), (o), (n))
#define RW_CAS(p, o, n) \
(_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t);
unsigned long _atomic_cas_ulong(volatile unsigned long *,
unsigned long, unsigned long);
#endif /* __RWLOCK_PRIVATE */