vhost-user-test: signal data_cond when s->rings changes
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 Dec 2018 15:32:20 +0000 (16:32 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Feb 2019 15:48:40 +0000 (16:48 +0100)
This speeds up wait_for_rings_started, which currently is just waiting for
the timeout before checking s->rings.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1543851204-41186-8-git-send-email-pbonzini@redhat.com>

tests/vhost-user-test.c

index 9baaff4f24b3019358ec9cacab621f002f592dfb..8eb79437746d974c9d6bf278a1e5813793ef0f36 100644 (file)
@@ -384,6 +384,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
 
         assert(msg.payload.state.index < s->queues * 2);
         s->rings &= ~(0x1ULL << msg.payload.state.index);
+        g_cond_broadcast(&s->data_cond);
         break;
 
     case VHOST_USER_SET_MEM_TABLE:
@@ -425,6 +426,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_VRING_BASE:
         assert(msg.payload.state.index < s->queues * 2);
         s->rings |= 0x1ULL << msg.payload.state.index;
+        g_cond_broadcast(&s->data_cond);
         break;
 
     case VHOST_USER_GET_QUEUE_NUM: