From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zoqcu-0006KT-2b for qemu-devel@nongnu.org; Wed, 21 Oct 2015 06:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zoqct-0006Tj-78 for qemu-devel@nongnu.org; Wed, 21 Oct 2015 06:28:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zoqct-0006Te-0k for qemu-devel@nongnu.org; Wed, 21 Oct 2015 06:28:11 -0400 Date: Wed, 21 Oct 2015 13:28:07 +0300 From: "Michael S. Tsirkin" Message-ID: <1445423133-5119-29-git-send-email-mst@redhat.com> References: <1445423133-5119-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1445423133-5119-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 28/38] vhost-user-test: move wait_for_fds() out List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Peter Maydell , Yuanhan Liu , Thibaut Collet , =?us-ascii?B?PT9VVEYtOD9xP01hcmMtQW5kcj1DMz1BOT0yMEx1cmVhdT89?= From: Marc-Andr=E9 Lureau This function is a precondition for most vhost-user tests. Signed-off-by: Marc-Andr=E9 Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Thibaut Collet --- tests/vhost-user-test.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 56df5cc..827c0c4 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -126,12 +126,9 @@ static gboolean g_cond_wait_until(CompatGCond cond, = CompatGMutex mutex, } #endif =20 -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; =20 g_mutex_lock(&data_mutex); =20 @@ -148,6 +145,19 @@ static void read_guest_mem(void) g_assert_cmpint(fds_num, >, 0); g_assert_cmpint(fds_num, =3D=3D, memory.nregions); =20 + g_mutex_unlock(&data_mutex); +} + +static void read_guest_mem(void) +{ + uint32_t *guest_mem; + int i, j; + size_t size; + + wait_for_fds(); + + g_mutex_lock(&data_mutex); + /* iterate all regions */ for (i =3D 0; i < fds_num; i++) { =20 --=20 MST