diff options
author | jvde.github <jvde.github@gmail.com> | 2022-01-08 13:30:34 +0100 |
---|---|---|
committer | Steve Markgraf <steve@steve-m.de> | 2022-01-08 20:57:02 +0100 |
commit | 2659e2df31e592d74d6dd264a4f5ce242c6369c8 (patch) | |
tree | 3007d37515ac8837036e26ea0a1d41ad85cfa7ee /src/librtlsdr.c | |
parent | d770add42e87a40e59a0185521373f516778384b (diff) |
lib: force wait state after cancel of usb transfer
..and before handling usb events
This avoids an occasional crash when closing the device on Windows.
Also see https://github.com/libusb/libusb/issues/1043.
Diffstat (limited to 'src/librtlsdr.c')
-rw-r--r-- | src/librtlsdr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librtlsdr.c b/src/librtlsdr.c index 0146298..2682d77 100644 --- a/src/librtlsdr.c +++ b/src/librtlsdr.c @@ -1930,6 +1930,9 @@ int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx, /* handle events after canceling * to allow transfer status to * propagate */ +#ifdef _WIN32 + Sleep(1); +#endif libusb_handle_events_timeout_completed(dev->ctx, &zerotv, NULL); if (r < 0) |