diff options
| author | ruki <[email protected]> | 2019-12-17 22:32:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-12-17 09:16:56 +0800 |
| commit | fc61f2255c3c3cfd6b55b3ac6ffc3b3d52642add (patch) | |
| tree | b2c60c7357aac2f9ba623e7941fec606c6c370cf | |
| parent | 61d1ac3a859d4b81858483c6496c4d2125150b1c (diff) | |
support iocp in scheduler
| -rw-r--r-- | xmake/core/base/scheduler.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua index 50e42c5b6..483ff347a 100644 --- a/xmake/core/base/scheduler.lua +++ b/xmake/core/base/scheduler.lua @@ -265,7 +265,7 @@ function scheduler:sock_wait(sock, events, timeout) end -- enable edge-trigger mode if be supported - if poller:support(poller.OT_SOCK, poller.EV_SOCK_CLEAR) then + if self._SUPPORT_EV_SOCK_CLEAR then events = bit.bor(events, poller.EV_SOCK_CLEAR) end @@ -392,6 +392,11 @@ function scheduler:runloop() -- start loop self._STARTED = true + -- ensure poller has been initialized first (for windows/iocp) and check edge-trigger mode (for epoll/kqueue) + if poller:support(poller.OT_SOCK, poller.EV_SOCK_CLEAR) then + self._SUPPORT_EV_SOCK_CLEAR = true + end + -- start all ready coroutine tasks local co_ready_tasks = self._CO_READY_TASKS if co_ready_tasks then |
