Use the new atomic_cmpset_32().

This commit is contained in:
cognet 2005-04-07 22:06:05 +00:00
parent 6bb6868e16
commit c7b04f713a
4 changed files with 0 additions and 50 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -2,6 +2,4 @@
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
CFLAGS+= -DARM_HAS_ATOMIC_CMPSET_32
SRCS+= pthread_md.c

View File

@ -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_ */