diff options
| author | ruki <[email protected]> | 2020-02-01 00:45:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-01-31 22:35:01 +0800 |
| commit | 58745c5b93b25e0b2d7db700961e7657706bc94e (patch) | |
| tree | b123ed00700bbbfe127d87016c7ce733a9814f88 | |
| parent | 7fc59d939bd2cf426c9fb823a5a2616b0dd3b508 (diff) | |
improve scheduler
| -rw-r--r-- | xmake/core/base/poller.lua | 7 | ||||
| -rw-r--r-- | xmake/core/base/scheduler.lua | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/xmake/core/base/poller.lua b/xmake/core/base/poller.lua index 521b63458..335ba98a6 100644 --- a/xmake/core/base/poller.lua +++ b/xmake/core/base/poller.lua @@ -56,11 +56,8 @@ function poller:_pollerdata_set(cdata, data) end -- support events? -function poller:support(otype, events) - if otype == poller.OT_SOCK then - return io.poller_support(events) - end - return false, string.format("invalid poller object type(%d)!", otype) +function poller:support(events) + return io.poller_support(events) end -- spank poller to break the wait() and return all triggered events diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua index 5a92863b8..e7870dbe6 100644 --- a/xmake/core/base/scheduler.lua +++ b/xmake/core/base/scheduler.lua @@ -315,7 +315,7 @@ function scheduler:poller_wait(obj, events, timeout) end -- enable edge-trigger mode if be supported - if otype == poller.OT_SOCK and self._SUPPORT_EV_POLLER_CLEAR then + if self._SUPPORT_EV_POLLER_CLEAR and (otype == poller.OT_SOCK or otype == poller.OT_PIPE) then events = bit.bor(events, poller.EV_POLLER_CLEAR) end @@ -463,7 +463,7 @@ function scheduler:runloop() 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_POLLER_CLEAR) then + if poller:support(poller.EV_POLLER_CLEAR) then self._SUPPORT_EV_POLLER_CLEAR = true end |
