* [Qemu-devel] [RFC PATCH v2 02/35] multi-process: util: Add qemu_thread_cancel() to cancel running thread
@ 2019-06-17 18:15 elena.ufimtseva
0 siblings, 0 replies; only message in thread
From: elena.ufimtseva @ 2019-06-17 18:15 UTC (permalink / raw)
To: qemu-devel
Cc: elena.ufimtseva, john.g.johnson, jag.raman, konrad.wilk,
ross.lagerwall, liran.alon, stefanha, pbonzini, kanth.ghatraju
From: Jagannathan Raman <jag.raman@oracle.com>
qemu_thread_cancel() added to destroy a given running thread.
This will be needed in the following patches.
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
---
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 55d83a907c..78791beae9 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -156,6 +156,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 1bf5e65dea..7c89071048 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -573,3 +573,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__);
+ }
+}
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-17 18:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17 18:15 [Qemu-devel] [RFC PATCH v2 02/35] multi-process: util: Add qemu_thread_cancel() to cancel running thread elena.ufimtseva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).