diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-08-12 11:21:44 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-08-12 11:21:44 +0000 |
| commit | dee802387c3c68ef25d5f44b6cbd3324d973c3bf (patch) | |
| tree | c1c4316d24394d009fd41596f05fc41f0fd5078a /tests/lib | |
| parent | 3c51c3b15cec9a4c15c4ef29110ad82bc7b7c258 (diff) | |
membar(3): Fix t_spinlock for machines with hash-locked atomics.
Regular stores don't participate in the hash-locking scheme, so use
atomic_swap instead of a regular store here.
Diffstat (limited to 'tests/lib')
| -rw-r--r-- | tests/lib/libc/membar/t_spinlock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/lib/libc/membar/t_spinlock.c b/tests/lib/libc/membar/t_spinlock.c index 7a2f910267f..d7ebdbd83ee 100644 --- a/tests/lib/libc/membar/t_spinlock.c +++ b/tests/lib/libc/membar/t_spinlock.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_spinlock.c,v 1.3 2022/04/10 11:36:32 riastradh Exp $ */ +/* $NetBSD: t_spinlock.c,v 1.4 2022/08/12 11:21:44 riastradh Exp $ */ /*- * Copyright (c) 2022 The NetBSD Foundation, Inc. @@ -27,7 +27,9 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_spinlock.c,v 1.3 2022/04/10 11:36:32 riastradh Exp $"); +__RCSID("$NetBSD: t_spinlock.c,v 1.4 2022/08/12 11:21:44 riastradh Exp $"); + +#include <sys/types.h> #include <sys/atomic.h> #include <sys/param.h> @@ -76,7 +78,11 @@ unlock(void) { membar_release(); +#ifdef __HAVE_HASHLOCKED_ATOMICS + (void)atomic_cas_uint(&lockbit, 1, 0); +#else lockbit = 0; +#endif } static void * |
