Use the new atomic_cmpset_32().
This commit is contained in:
parent
2204e78f5e
commit
e0d6cac076
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144765
@ -51,18 +51,3 @@ atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
#endif
|
||||
|
||||
static inline u_int32_t
|
||||
atomic_cmpset_32(volatile u_int32_t *p, u_int32_t cmpval, u_int32_t newval)
|
||||
{
|
||||
kse_critical_t crit = _kse_critical_enter();
|
||||
int ret;
|
||||
|
||||
if (*p == cmpval) {
|
||||
*p = newval;
|
||||
ret = 1;
|
||||
} else
|
||||
ret = 0;
|
||||
_kse_critical_leave(crit);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -51,18 +51,3 @@ atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
#endif
|
||||
|
||||
static inline u_int32_t
|
||||
atomic_cmpset_32(volatile u_int32_t *p, u_int32_t cmpval, u_int32_t newval)
|
||||
{
|
||||
kse_critical_t crit = _kse_critical_enter();
|
||||
int ret;
|
||||
|
||||
if (*p == cmpval) {
|
||||
*p = newval;
|
||||
ret = 1;
|
||||
} else
|
||||
ret = 0;
|
||||
_kse_critical_leave(crit);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,4 @@
|
||||
|
||||
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
|
||||
|
||||
CFLAGS+= -DARM_HAS_ATOMIC_CMPSET_32
|
||||
|
||||
SRCS+= pthread_md.c
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
|
||||
static __inline int atomic_cmpset_32(volatile uint32_t *, uint32_t, uint32_t);
|
||||
|
||||
#include <sys/umtx.h>
|
||||
|
||||
#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
|
||||
@ -87,20 +85,4 @@ _get_curthread(void)
|
||||
|
||||
extern struct umtx arm_umtx;
|
||||
|
||||
static __inline int
|
||||
atomic_cmpset_32(volatile uint32_t *dst, uint32_t old, uint32_t newval)
|
||||
{
|
||||
int ret;
|
||||
|
||||
_umtx_lock(&arm_umtx);
|
||||
arm_umtx.u_owner = (void*)((uint32_t)arm_umtx.u_owner | UMTX_CONTESTED);
|
||||
if (*dst == old) {
|
||||
*dst = newval;
|
||||
ret = 1;
|
||||
} else
|
||||
ret = 0;
|
||||
_umtx_unlock(&arm_umtx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif /* _PTHREAD_MD_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user