From: elena.ufimtseva@oracle.com
To: qemu-devel@nongnu.org
Cc: elena.ufimtseva@oracle.com, john.g.johnson@oracle.com,
jag.raman@oracle.com, konrad.wilk@oracle.com,
ross.lagerwall@citrix.com, liran.alon@oracle.com,
stefanha@redhat.com, pbonzini@redhat.com,
kanth.ghatraju@oracle.com
Subject: [Qemu-devel] [RFC PATCH v2 02/35] multi-process: util: Add qemu_thread_cancel() to cancel running thread
Date: Mon, 17 Jun 2019 11:15:07 -0700 [thread overview]
Message-ID: <20190617181507.29189-1-elena.ufimtseva@oracle.com> (raw)
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
reply other threads:[~2019-06-17 18:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190617181507.29189-1-elena.ufimtseva@oracle.com \
--to=elena.ufimtseva@oracle.com \
--cc=jag.raman@oracle.com \
--cc=john.g.johnson@oracle.com \
--cc=kanth.ghatraju@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=liran.alon@oracle.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ross.lagerwall@citrix.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).