aboutsummaryrefslogtreecommitdiffstats
path: root/src/libosmo-fl2k.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libosmo-fl2k.c')
-rw-r--r--src/libosmo-fl2k.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/libosmo-fl2k.c b/src/libosmo-fl2k.c
index 9116aff..34b854e 100644
--- a/src/libosmo-fl2k.c
+++ b/src/libosmo-fl2k.c
@@ -25,15 +25,18 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <math.h>
+#include <libusb.h>
+#include <pthread.h>
#ifndef _WIN32
#include <unistd.h>
+#define sleep_ms(ms) usleep(ms*1000)
+#else
+#include <windows.h>
+#define sleep_ms(ms) Sleep(ms)
#endif
-#include <math.h>
-#include <libusb.h>
-#include <pthread.h>
-
/*
* All libusb callback functions should be marked with the LIBUSB_CALL macro
* to ensure that they are compiled with the same calling convention as libusb.
@@ -476,13 +479,8 @@ int fl2k_close(fl2k_dev_t *dev)
if(!dev->dev_lost) {
/* block until all async operations have been completed (if any) */
- while (FL2K_INACTIVE != dev->async_status) {
-#ifdef _WIN32
- Sleep(1);
-#else
- usleep(1000);
-#endif
- }
+ while (FL2K_INACTIVE != dev->async_status)
+ sleep_ms(100);
fl2k_deinit_device(dev);
}