From patchwork Fri Apr 20 17:01:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 154088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 39769B6FBB for ; Sat, 21 Apr 2012 04:10:09 +1000 (EST) Received: from localhost ([::1]:39202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLHBF-00056u-F2 for incoming@patchwork.ozlabs.org; Fri, 20 Apr 2012 12:59:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLHAB-000367-9Z for qemu-devel@nongnu.org; Fri, 20 Apr 2012 12:58:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SLHA6-000066-B7 for qemu-devel@nongnu.org; Fri, 20 Apr 2012 12:58:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLHA6-00005Y-2O for qemu-devel@nongnu.org; Fri, 20 Apr 2012 12:58:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3KGwHGa011940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 Apr 2012 12:58:19 -0400 Received: from dhcp-5-188.str.redhat.com (vpn1-5-13.ams2.redhat.com [10.36.5.13]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3KGvxeo024394; Fri, 20 Apr 2012 12:58:16 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 20 Apr 2012 19:01:17 +0200 Message-Id: <1334941304-2491-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1334941304-2491-1-git-send-email-kwolf@redhat.com> References: <1334941304-2491-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 11/38] block: allow interrupting a co_sleep_ns X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini In the next patch we want to reenter the coroutine from block_job_cancel_sync and cancel the timer. Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- qemu-coroutine-sleep.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qemu-coroutine-sleep.c b/qemu-coroutine-sleep.c index fd65274..d7083ee 100644 --- a/qemu-coroutine-sleep.c +++ b/qemu-coroutine-sleep.c @@ -23,7 +23,6 @@ static void co_sleep_cb(void *opaque) { CoSleepCB *sleep_cb = opaque; - qemu_free_timer(sleep_cb->ts); qemu_coroutine_enter(sleep_cb->co, NULL); } @@ -35,4 +34,6 @@ void coroutine_fn co_sleep_ns(QEMUClock *clock, int64_t ns) sleep_cb.ts = qemu_new_timer(clock, SCALE_NS, co_sleep_cb, &sleep_cb); qemu_mod_timer(sleep_cb.ts, qemu_get_clock_ns(clock) + ns); qemu_coroutine_yield(); + qemu_del_timer(sleep_cb.ts); + qemu_free_timer(sleep_cb.ts); }