From patchwork Thu Feb 24 20:05:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 84475 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B9812B6F06 for ; Fri, 25 Feb 2011 07:19:19 +1100 (EST) Received: from localhost ([127.0.0.1]:52840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pshee-0003vS-R7 for incoming@patchwork.ozlabs.org; Thu, 24 Feb 2011 15:19:17 -0500 Received: from [140.186.70.92] (port=38368 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PshUh-0008A5-W3 for qemu-devel@nongnu.org; Thu, 24 Feb 2011 15:09:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PshRI-0004aT-Qb for qemu-devel@nongnu.org; Thu, 24 Feb 2011 15:05:29 -0500 Received: from e34.co.us.ibm.com ([32.97.110.152]:44846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PshRI-0004aN-Jh for qemu-devel@nongnu.org; Thu, 24 Feb 2011 15:05:28 -0500 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p1OJrsQ8004629 for ; Thu, 24 Feb 2011 12:53:55 -0700 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1OK5P8R120994 for ; Thu, 24 Feb 2011 13:05:25 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1OK5PXR021711 for ; Thu, 24 Feb 2011 13:05:25 -0700 Received: from [9.59.241.154] (d941e-10.watson.ibm.com [9.59.241.154]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p1OK5OSG021669; Thu, 24 Feb 2011 13:05:24 -0700 From: Stefan Berger To: "qemu-devel@nongnu.org" In-Reply-To: <1298576432.17424.1.camel@d941e-10> References: <1298576432.17424.1.camel@d941e-10> Date: Thu, 24 Feb 2011 15:05:24 -0500 Message-ID: <1298577924.17969.5.camel@d941e-10> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 (2.32.1-1.fc14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 32.97.110.152 Cc: Andreas Niederl Subject: [Qemu-devel] [PATCH 4/5]: Implement qemu_thread_join function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch provides support for 'joining a thread' by wrapping 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.c | 5 +++++ qemu-thread.h | 1 + 2 files changed, 6 insertions(+) Index: qemu-git/qemu-thread.c =================================================================== --- qemu-git.orig/qemu-thread.c +++ qemu-git/qemu-thread.c @@ -190,3 +190,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 @@ -40,5 +40,6 @@ void qemu_thread_signal(QemuThread *thre void qemu_thread_self(QemuThread *thread); int qemu_thread_equal(QemuThread *thread1, QemuThread *thread2); void qemu_thread_exit(void *retval); +int qemu_thread_join(QemuThread *thread, void **retval); #endif