vhost-user-test: fix chardriver race
commit9732baf67850dac57dfc7dc8980bf408889a8973
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 27 Nov 2015 14:41:18 +0000 (27 15:41 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 2 Dec 2015 14:42:26 +0000 (2 16:42 +0200)
tree1e76601c535c6809a6d00ebff8201d663f1fe8ce
parent9d7b969ea6d9663a94760c6c131481b366f4d38a
vhost-user-test: fix chardriver race

vhost-user-tests uses a helper thread to dispatch the vhost-user servers
sources. However the CharDriverState is not thread-safe. Therefore, when
it's given to the thread, it shouldn't be manipulated concurrently.

We dispatch cleaning the server in an idle source. By the end of the
test, we ensure not to leave anything behind by joining the thread and
finishing the sources dispatch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
tests/vhost-user-test.c