windows: Provide a sched_yield() implementation
authorMartin Willi <martin@revosec.ch>
Wed, 23 Oct 2013 14:44:14 +0000 (16:44 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:01 +0000 (15:53 +0200)
src/libstrongswan/credentials/sets/cert_cache.c
src/libstrongswan/tests/suites/test_threading.c
src/libstrongswan/tests/suites/test_watcher.c
src/libstrongswan/utils/utils.h
src/libstrongswan/utils/windows.h

index e8f0e7e..563f4bd 100644 (file)
@@ -16,7 +16,6 @@
 #include "cert_cache.h"
 
 #include <time.h>
-#include <sched.h>
 
 #include <library.h>
 #include <threading/rwlock.h>
index 496310c..0526d9d 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "test_suite.h"
 
-#include <sched.h>
 #include <unistd.h>
 
 #include <threading/thread.h>
index 451fa0b..11b4c3a 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <library.h>
 
-#include <sched.h>
 #include <unistd.h>
 #include <errno.h>
 
index c14b9c1..ced47a4 100644 (file)
@@ -36,6 +36,7 @@
 # include <sys/socket.h>
 # include <netdb.h>
 # include <netinet/in.h>
+# include <sched.h>
 #endif
 
 /**
index 90c92fd..83a6d62 100644 (file)
@@ -68,6 +68,15 @@ static inline void srandom(unsigned int 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
  */
 #define strdup strdup_windows