Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/tests/lib/libc/sys Pull up following revision(s) (request...
details: https://anonhg.NetBSD.org/src/rev/9c739780935a
branches: netbsd-9
changeset: 458487:9c739780935a
user: martin <martin%NetBSD.org@localhost>
date: Tue Oct 15 18:40:02 2019 +0000
description:
Pull up following revision(s) (requested by kamil in ticket #314):
tests/lib/libc/sys/t_ptrace_wait.c: revision 1.137
Fix race in t_ptrace_wait* LWP tests
Increment the done variable under a mutex. This variable was updated
non-atomically and sometimes not reaching the expected treshold.
diffstat:
tests/lib/libc/sys/t_ptrace_wait.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 1c7c600f76c4 -r 9c739780935a tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:38:39 2019 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:40:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.131.2.2 2019/10/15 18:34:34 martin Exp $ */
+/* $NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $ */
/*-
* Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.2 2019/10/15 18:34:34 martin Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -5432,12 +5432,15 @@
#define TRACE_THREADS_NUM 100
static volatile int done;
+pthread_mutex_t trace_threads_mtx = PTHREAD_MUTEX_INITIALIZER;
static void *
trace_threads_cb(void *arg __unused)
{
+ pthread_mutex_lock(&trace_threads_mtx);
done++;
+ pthread_mutex_unlock(&trace_threads_mtx);
while (done < TRACE_THREADS_NUM)
sched_yield();
Home |
Main Index |
Thread Index |
Old Index