[Spice-commits] tests/cd-emu.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 28 13:53:04 UTC 2020
tests/cd-emu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 4c031d1ecdf598e0bee7276623e658f321cb3330
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Feb 28 12:48:41 2020 +0000
test-cd-emu: Avoid deadlock waiting for libusb event thread
Remove a race condition testing code with no libusb enabled.
Setting libusb_context field while the libusb event thread was using
causes a potential deadlock in the test.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/cd-emu.c b/tests/cd-emu.c
index d99ca88..9d90aab 100644
--- a/tests/cd-emu.c
+++ b/tests/cd-emu.c
@@ -239,10 +239,15 @@ static void attach(const void *param)
void *libusb_context_saved = be->libusb_context;
if (!libusb_enabled) {
+ spice_usb_backend_deregister_hotplug(be);
be->libusb_context = NULL;
}
usb_ch = spice_usb_backend_channel_new(be, SPICE_USBREDIR_CHANNEL(ch));
- be->libusb_context = libusb_context_saved;
+ if (!libusb_enabled) {
+ be->libusb_context = libusb_context_saved;
+ spice_usb_backend_register_hotplug(be, NULL, test_hotplug_callback, &err);
+ g_assert_null(err);
+ }
g_assert_nonnull(usb_ch);
for (int loop = 0; loop < 2; loop++) {
More information about the Spice-commits
mailing list