windows: Provide a sched_yield() implementation
This commit is contained in:
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user