[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/14] bsd-user: Add stop_all_tasks
From: |
Warner Losh |
Subject: |
[PATCH 10/14] bsd-user: Add stop_all_tasks |
Date: |
Wed, 22 Sep 2021 00:14:34 -0600 |
Similar to the same function in linux-user: this stops all the current tasks.
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
bsd-user/main.c | 9 +++++++++
bsd-user/qemu.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index ee84554854..cb5ea40236 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -195,6 +195,15 @@ static void usage(void)
__thread CPUState *thread_cpu;
+void stop_all_tasks(void)
+{
+ /*
+ * We trust when using NPTL (pthreads) start_exclusive() handles thread
+ * stopping correctly.
+ */
+ start_exclusive();
+}
+
bool qemu_cpu_is_self(CPUState *cpu)
{
return thread_cpu == cpu;
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 431c5cfc03..4ee57b91f0 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -103,6 +103,7 @@ typedef struct TaskState {
} __attribute__((aligned(16))) TaskState;
void init_task_state(TaskState *ts);
+void stop_all_tasks(void);
extern const char *qemu_uname_release;
/*
--
2.32.0
- [PATCH 04/14] bsd-user: export get_errno and is_error from syscall.c, (continued)
- [PATCH 04/14] bsd-user: export get_errno and is_error from syscall.c, Warner Losh, 2021/09/22
- [PATCH 09/14] bsd-user: Remove used from TaskState, Warner Losh, 2021/09/22
- [PATCH 13/14] bsd-user: Rename sigqueue to qemu_sigqueue, Warner Losh, 2021/09/22
- [PATCH 10/14] bsd-user: Add stop_all_tasks,
Warner Losh <=
- [PATCH 11/14] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interface, Warner Losh, 2021/09/22
- [PATCH 12/14] bsd-user/sysarch: Provide a per-arch framework for sysarch syscall, Warner Losh, 2021/09/22
- [PATCH 03/14] bsd-user: TARGET_RESET define is unused, remove it, Warner Losh, 2021/09/22