From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34709 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q51II-00056j-Bk for qemu-devel@nongnu.org; Wed, 30 Mar 2011 15:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q51IH-0005m4-07 for qemu-devel@nongnu.org; Wed, 30 Mar 2011 15:43:06 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:41010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q51IG-0005lx-Tw for qemu-devel@nongnu.org; Wed, 30 Mar 2011 15:43:04 -0400 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p2UJFjWx008882 for ; Wed, 30 Mar 2011 15:15:45 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 8095438C8039 for ; Wed, 30 Mar 2011 15:42:50 -0400 (EDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2UJgdOn178244 for ; Wed, 30 Mar 2011 15:42:40 -0400 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2UJgdAK020964 for ; Wed, 30 Mar 2011 13:42:39 -0600 Message-Id: <20110330194237.957531180@linux.vnet.ibm.com> Date: Wed, 30 Mar 2011 15:42:17 -0400 From: Stefan Berger References: <20110330194211.732385449@linux.vnet.ibm.com> Content-Disposition: inline; filename=qemu_thread_join.patch Subject: [Qemu-devel] [PATCH V2 6/9] Implement qemu_thread_join function List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stefanb@linux.vnet.ibm.com, qemu-devel@nongnu.org Cc: andreas.niederl@iaik.tugraz.at This patch provides support for 'joining a thread' by wrapping the POSIX pthread_join with qemu_thread_join. Since the backend implementation is based on threads and I am stopping and starting that thread during operations like 'snapshot resume', I do use this functionality to synchronize with the TPM thread's termination before terminating the TPM, creating a new one and loading previous state from the time of the snapshot into the TPM. Signed-off-by: Stefan Berger --- qemu-thread-posix.c | 5 +++++ qemu-thread.h | 1 + 2 files changed, 6 insertions(+) Index: qemu-git/qemu-thread-posix.c =================================================================== --- qemu-git.orig/qemu-thread-posix.c +++ qemu-git/qemu-thread-posix.c @@ -147,3 +147,8 @@ void qemu_thread_exit(void *retval) { pthread_exit(retval); } + +int qemu_thread_join(QemuThread *thread, void **retval) +{ + return pthread_join(thread->thread, retval); +} Index: qemu-git/qemu-thread.h =================================================================== --- qemu-git.orig/qemu-thread.h +++ qemu-git/qemu-thread.h @@ -35,5 +35,6 @@ void qemu_thread_create(QemuThread *thre void qemu_thread_get_self(QemuThread *thread); int qemu_thread_is_self(QemuThread *thread); void qemu_thread_exit(void *retval); +int qemu_thread_join(QemuThread *thread, void **retval); #endif