diff mbox series

[10/14] bsd-user: Add stop_all_tasks

Message ID 20210922061438.27645-11-imp@bsdimp.com (mailing list archive)
State New, archived
Headers show
Series bsd-user: misc cleanup for aarch64 import | expand

Commit Message

Warner Losh Sept. 22, 2021, 6:14 a.m. UTC
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(+)

Comments

Richard Henderson Sept. 23, 2021, 6:04 p.m. UTC | #1
On 9/21/21 11:14 PM, Warner Losh wrote:
> +void stop_all_tasks(void)
> +{
> +    /*
> +     * We trust when using NPTL (pthreads) start_exclusive() handles thread
> +     * stopping correctly.
> +     */
> +    start_exclusive();
> +}

Eh.  It begs the question of why this is present, as opposed to calling start_exclusive 
directly for the one (1) use.  Looks to me like we should remove it.


r~
diff mbox series

Patch

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;
 
 /*