From 4761f184b8e1aa8c7b59f3cda54eb23fa21d373e Mon Sep 17 00:00:00 2001 From: zeropool <1285055670@qq.com> Date: Sun, 17 May 2020 17:09:49 +0800 Subject: [PATCH] patch for windows sched_yield --- chan/eb_chan.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chan/eb_chan.h b/chan/eb_chan.h index e4855b4..da04294 100644 --- a/chan/eb_chan.h +++ b/chan/eb_chan.h @@ -24,6 +24,14 @@ #include #include + +#if defined(__MINGW32__) || defined(__CYGWIN__) +#include +int sched_yield() { + return SwitchToThread(); +} +#endif + // ####################################################### // ## eb_nsec.h // ####################################################### @@ -1436,4 +1444,4 @@ eb_chan_op *eb_chan_select_list(eb_nsec timeout, eb_chan_op *const ops[], size_t return result; } -#endif /* EB_CHAN_H */ \ No newline at end of file +#endif /* EB_CHAN_H */