windows: Provide a sched_yield() implementation

This commit is contained in:
Martin Willi
2014-06-04 15:53:01 +02:00
parent 5f35b73344
commit 266ee0a190
5 changed files with 10 additions and 3 deletions
@@ -16,7 +16,6 @@
#include "cert_cache.h" #include "cert_cache.h"
#include <time.h> #include <time.h>
#include <sched.h>
#include <library.h> #include <library.h>
#include <threading/rwlock.h> #include <threading/rwlock.h>
@@ -16,7 +16,6 @@
#include "test_suite.h" #include "test_suite.h"
#include <sched.h>
#include <unistd.h> #include <unistd.h>
#include <threading/thread.h> #include <threading/thread.h>
@@ -17,7 +17,6 @@
#include <library.h> #include <library.h>
#include <sched.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
+1
View File
@@ -36,6 +36,7 @@
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
# include <netinet/in.h> # include <netinet/in.h>
# include <sched.h>
#endif #endif
/** /**
+9
View File
@@ -67,6 +67,15 @@ static inline void srandom(unsigned int seed)
srand(seed); srand(seed);
} }
/**
* Replacement of sched_yield(2) from <sched.h>
*/
static inline int sched_yield(void)
{
Sleep(0);
return 0;
}
/** /**
* strdup(3), the Windows variant can't free(strdup("")) and others * strdup(3), the Windows variant can't free(strdup("")) and others
*/ */