Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/membar membar(3): Fix t_spinlock for machines...
details: https://anonhg.NetBSD.org/src/rev/99e255b4673c
branches: trunk
changeset: 368902:99e255b4673c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Aug 12 11:21:44 2022 +0000
description:
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:
tests/lib/libc/membar/t_spinlock.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (32 lines):
diff -r 93496857deaa -r 99e255b4673c tests/lib/libc/membar/t_spinlock.c
--- a/tests/lib/libc/membar/t_spinlock.c Fri Aug 12 11:15:40 2022 +0000
+++ b/tests/lib/libc/membar/t_spinlock.c Fri Aug 12 11:21:44 2022 +0000
@@ -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 @@
{
membar_release();
+#ifdef __HAVE_HASHLOCKED_ATOMICS
+ (void)atomic_cas_uint(&lockbit, 1, 0);
+#else
lockbit = 0;
+#endif
}
static void *
Home |
Main Index |
Thread Index |
Old Index