Patchwork [1/4] qemu-thread: add qemu_thread_join().

login
register
mail settings
Submitter Yoshiaki Tamura
Date June 1, 2010, 3:40 p.m.
Message ID <1275406821-30024-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>
Download mbox | patch
Permalink /patch/54229/
State New
Headers show

Comments

Yoshiaki Tamura - June 1, 2010, 3:40 p.m.
Add missing function to join created thread.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
 qemu-thread.c |    9 +++++++++
 qemu-thread.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

Patch

diff --git a/qemu-thread.c b/qemu-thread.c
index afc9933..21953cd 100644
--- a/qemu-thread.c
+++ b/qemu-thread.c
@@ -183,3 +183,12 @@  void qemu_thread_exit(void *retval)
 {
     pthread_exit(retval);
 }
+
+void qemu_thread_join(QemuThread *thread, void **retval)
+{
+    int err;
+
+    err = pthread_join(thread->thread, retval);
+    if (err)
+        error_exit(err, __func__);    
+}
diff --git a/qemu-thread.h b/qemu-thread.h
index 19bb30c..9225b33 100644
--- a/qemu-thread.h
+++ b/qemu-thread.h
@@ -40,5 +40,6 @@  void qemu_thread_signal(QemuThread *thread, int sig);
 void qemu_thread_self(QemuThread *thread);
 int qemu_thread_equal(QemuThread *thread1, QemuThread *thread2);
 void qemu_thread_exit(void *retval);
+void qemu_thread_join(QemuThread *thread, void **retval);
 
 #endif