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

This commit is contained in:
Martin Willi 2014-01-02 14:29:35 +01:00
parent 9df2a04a93
commit 3d50dd47ef
1 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include <ws2tcpip.h>
#include <direct.h>
#include <inttypes.h>
#include <unistd.h>
/* undef Windows variants evaluating values more than once */
#undef min
@ -79,7 +80,8 @@ static inline int sched_yield(void)
/**
* 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);
return 0;