Add sleep and usleep macros so all sleeps use nanosleep

pull/155/head
Michael Black 2019-12-22 11:17:22 -06:00
rodzic 73319f68b3
commit ed339b1c2b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6599353EC683404D
4 zmienionych plików z 17 dodań i 6 usunięć

Wyświetl plik

@ -27,7 +27,6 @@
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <math.h>
#include <sys/time.h>
#include "hamlib/rig.h"
#include "serial.h"

Wyświetl plik

@ -92,6 +92,20 @@
#define CONSTANT_64BIT_FLAG(BIT) (1ull << (BIT))
#endif
#include <time.h>
#undef sleep
#undef usleep
#if 1
#define usleep(n) \
do { \
struct timespec t;\
t.tv_sec=0;\
t.tv_nsec = n*1000ul;\
nanosleep(&t,NULL);\
} while(0)
#define sleep(n) do { struct timespec t;t.tv_sec=0;t.tv_nsec = n*1000000000ul;nanosleep(&t,NULL);} while(0)
#endif
__BEGIN_DECLS
extern HAMLIB_EXPORT_VAR(const char) hamlib_version[];

Wyświetl plik

@ -35,8 +35,6 @@
# include "config.h"
#endif
#include <hamlib/rig.h>
/*
* Compile only if libusb is available
*/
@ -46,10 +44,11 @@
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <hamlib/rig.h>
#ifdef HAVE_LIBUSB_H
# include <libusb.h>

Wyświetl plik

@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif