diff options
author | Steve Markgraf <steve@steve-m.de> | 2018-06-17 02:38:15 +0200 |
---|---|---|
committer | Steve Markgraf <steve@steve-m.de> | 2018-06-17 02:38:15 +0200 |
commit | 7ae9754ede8806df16977be28a4811fcf5eacdd0 (patch) | |
tree | e46fe8ba8be74dd01ee29dfd15b05232660b08e4 /src/libosmo-fl2k.c | |
parent | b745896cbe4ea6619244a7034cbe7c617a91f75f (diff) | |
download | osmo-fl2k-7ae9754ede8806df16977be28a4811fcf5eacdd0.tar.gz osmo-fl2k-7ae9754ede8806df16977be28a4811fcf5eacdd0.tar.bz2 osmo-fl2k-7ae9754ede8806df16977be28a4811fcf5eacdd0.zip |
fix sleep durations on Windows
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src/libosmo-fl2k.c')
-rw-r--r-- | src/libosmo-fl2k.c | 20 |
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); } |