From patchwork Thu Sep 24 16:22:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 522432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7F5F4140281 for ; Fri, 25 Sep 2015 02:32:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ICM40hVQ; dkim-atps=neutral Received: from localhost ([::1]:45946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf9Rx-0000HI-3u for incoming@patchwork.ozlabs.org; Thu, 24 Sep 2015 12:32:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf9Ib-0001Hc-Th for qemu-devel@nongnu.org; Thu, 24 Sep 2015 12:23:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf9Ia-0005Kz-13 for qemu-devel@nongnu.org; Thu, 24 Sep 2015 12:23:09 -0400 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:36613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf9IZ-0005Kn-Tv for qemu-devel@nongnu.org; Thu, 24 Sep 2015 12:23:07 -0400 Received: by qgx61 with SMTP id 61so48453109qgx.3 for ; Thu, 24 Sep 2015 09:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=aE3+7nZPDlM54ViH42R5lqlfIWlNXen4GbWwYDt0wUw=; b=ICM40hVQTyVjCHL/jcVcoEjqr/U6IMxWIKBMzVBt/Aql6Ne8JUbokp7EzTEnXYdWVZ bBm/egaEes0NuSeJomrDa9Glr4+FgUMDsD2vJb/wAEGDzZI3oVx/AhypR/6YsOvbcDxx Q7VNZVcA3JjFIXuogU3+frNVI4jpWUvhpodz5gY7PhndJ28yQWB856uUc2dy7mb5CDTv +ImY7BrOTxapU+34V/pqV9QkWK/yVgiqcHfvHtI1WrYV35qgjotI9AdyH0JxBSqx1WrK H+rB8u4tO46/EPwzryO5CFNzY5OiuRCS+pIJUlfaEXbXkxUOX0HD71M5igHF8ADoLnVw iL/Q== X-Received: by 10.140.92.106 with SMTP id a97mr774462qge.43.1443111787660; Thu, 24 Sep 2015 09:23:07 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id u37sm3728308qge.6.2015.09.24.09.23.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 09:23:07 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 24 Sep 2015 18:22:16 +0200 Message-Id: <1443111741-4736-17-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443111741-4736-1-git-send-email-marcandre.lureau@redhat.com> References: <1443111741-4736-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::22e Cc: haifeng.lin@huawei.com, mst@redhat.com, thibaut.collet@6wind.com, jasowang@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH v5 16/21] vhost-user-test: move wait_for_fds() out 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: Marc-André Lureau This function is a precondition for most vhost-user tests. Signed-off-by: Marc-André Lureau --- tests/vhost-user-test.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 77b7b68..88714ff 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -205,15 +205,11 @@ static GThread *_thread_new(const gchar *name, GThreadFunc func, gpointer data) return thread; } -static void read_guest_mem(void) +static void wait_for_fds(void) { - uint32_t *guest_mem; gint64 end_time; - int i, j; - size_t size; g_mutex_lock(data_mutex); - end_time = _get_time() + 5 * G_TIME_SPAN_SECOND; while (!fds_num) { if (!_cond_wait_until(data_cond, data_mutex, end_time)) { @@ -227,6 +223,17 @@ static void read_guest_mem(void) g_assert_cmpint(fds_num, >, 0); g_assert_cmpint(fds_num, ==, memory.nregions); + g_mutex_unlock(data_mutex); +} + +static void read_guest_mem(void) +{ + uint32_t *guest_mem; + int i, j; + size_t size; + + wait_for_fds(); + /* iterate all regions */ for (i = 0; i < fds_num; i++) {