windows: Overload sleep() cancellable when it is defined in <unistd.h>

This commit is contained in:
Martin Willi
2014-06-04 15:53:04 +02:00
parent 9df2a04a93
commit 3d50dd47ef
+3 -1
View File
@@ -25,6 +25,7 @@
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <direct.h> #include <direct.h>
#include <inttypes.h> #include <inttypes.h>
#include <unistd.h>
/* undef Windows variants evaluating values more than once */ /* undef Windows variants evaluating values more than once */
#undef min #undef min
@@ -79,7 +80,8 @@ static inline int sched_yield(void)
/** /**
* Replacement of sleep(3), cancellable by thread_cancel() * Replacement of sleep(3), cancellable by thread_cancel()
*/ */
static inline int sleep(unsigned int seconds) #define sleep sleep_cancellable
static inline int sleep_cancellable(unsigned int seconds)
{ {
SleepEx(seconds * 1000, TRUE); SleepEx(seconds * 1000, TRUE);
return 0; return 0;