[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v4 PATCH 02/49] multi-process: util: Add qemu_thread_cancel() to ca
From: |
Jagannathan Raman |
Subject: |
[RFC v4 PATCH 02/49] multi-process: util: Add qemu_thread_cancel() to cancel running thread |
Date: |
Thu, 24 Oct 2019 05:08:43 -0400 |
qemu_thread_cancel() added to destroy a given running thread.
This will be needed in the following patches.
Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
Signed-off-by: Elena Ufimtseva <address@hidden>
---
include/qemu/thread.h | 1 +
util/qemu-thread-posix.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index 047db03..fe7fa5a 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -175,6 +175,7 @@ void qemu_thread_create(QemuThread *thread, const char
*name,
void *(*start_routine)(void *),
void *arg, int mode);
void *qemu_thread_join(QemuThread *thread);
+void qemu_thread_cancel(QemuThread *thread);
void qemu_thread_get_self(QemuThread *thread);
bool qemu_thread_is_self(QemuThread *thread);
void qemu_thread_exit(void *retval);
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index 838980a..2fd85ed 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -590,3 +590,13 @@ void *qemu_thread_join(QemuThread *thread)
}
return ret;
}
+
+void qemu_thread_cancel(QemuThread *thread)
+{
+ int err;
+
+ err = pthread_cancel(thread->thread);
+ if (err) {
+ error_exit(err, __func__);
+ }
+}
--
1.8.3.1
- [RFC v4 PATCH 00/49] Initial support of multi-process qemu, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 03/49] multi-process: add a command line option for debug file, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 01/49] multi-process: memory: alloc RAM from file at offset, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 02/49] multi-process: util: Add qemu_thread_cancel() to cancel running thread,
Jagannathan Raman <=
- [RFC v4 PATCH 04/49] multi-process: Add stub functions to facilate build of multi-process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 05/49] multi-process: Add config option for multi-process QEMU, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 06/49] multi-process: build system for remote device process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 09/49] multi-process: setup PCI host bridge for remote device, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 11/49] multi-process: setup memory manager for remote device, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 10/49] multi-process: setup a machine object for remote device process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 13/49] multi-process: introduce proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 14/49] mutli-process: build remote command line args, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 16/49] multi-process: Add LSI device proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 15/49] multi-process: PCI BAR read/write handling for proxy & remote endpoints, Jagannathan Raman, 2019/10/24