OSDN Git Service

bsd-user: Add stop_all_tasks
authorWarner Losh <imp@bsdimp.com>
Sun, 19 Sep 2021 07:11:43 +0000 (01:11 -0600)
committerWarner Losh <imp@bsdimp.com>
Mon, 18 Oct 2021 18:51:39 +0000 (12:51 -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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
bsd-user/main.c
bsd-user/qemu.h

index ee84554..cb5ea40 100644 (file)
@@ -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;
index c1170f1..cdb8514 100644 (file)
@@ -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;
 
 /*