diff options
author | 1999-05-26 00:11:27 +0000 | |
---|---|---|
committer | 1999-05-26 00:11:27 +0000 | |
commit | 4ee1e7a224c160a362763f82739fe73ec0705340 (patch) | |
tree | 3ec3c22de6740de70d9e969762a599d486ca983d /lib/libpthread | |
parent | document double-unlock check and how it relates to the std. (POSIX says in one paragraph that the behaviour is undefined, then in another says that EPERM should be returned (diff) | |
download | wireguard-openbsd-4ee1e7a224c160a362763f82739fe73ec0705340.tar.xz wireguard-openbsd-4ee1e7a224c160a362763f82739fe73ec0705340.zip |
add mb (memory barrier) instruction. from FreeBSD
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/arch/alpha/_atomic_lock.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libpthread/arch/alpha/_atomic_lock.c b/lib/libpthread/arch/alpha/_atomic_lock.c index c496aee5002..5f11655ab1f 100644 --- a/lib/libpthread/arch/alpha/_atomic_lock.c +++ b/lib/libpthread/arch/alpha/_atomic_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: _atomic_lock.c,v 1.4 1998/12/21 13:03:43 d Exp $ */ +/* $OpenBSD: _atomic_lock.c,v 1.5 1999/05/26 00:11:27 d Exp $ */ /* * Atomic lock for alpha */ @@ -23,12 +23,16 @@ _atomic_lock(volatile _spinlock_lock_t * lock) success = 0; /* store the new value of the thrd-lock (unlock mem on store) */ /* - * XXX may need to add large branch forward for main line - * branch prediction to be right :( [note from linux] + * XXX may need to add *large* branch forward for main line + * branch prediction to be right :( [this note from linux] */ - __asm__( "stq_c %2, %0; beq %2, 1f; mov 1,%1; 1:" - : "=m"(*lock), "=r"(success) - : "r"(new) ); + __asm__( "stq_c %2, %0\n" + "beq %2, 1f\n" + "mb\n" + "mov 1, %1\n" + "1:" + : "=m"(*lock), "=r"(success) + : "r"(new) ); } while (!success); return (old != _SPINLOCK_UNLOCKED); |