diff options
| author | ruki <[email protected]> | 2020-02-20 23:20:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-02-20 14:04:31 +0800 |
| commit | 8079f41e1a5143cc31780a8763bb83b6bcf3c1c9 (patch) | |
| tree | 2c1b9f19ab32e937ae04ce57c4c425453aa7b60e /xmake/core/base | |
| parent | a584475a0edd286d04bdeef81db86f925a38b5a2 (diff) | |
disable scheduler for interactive mode
Diffstat (limited to 'xmake/core/base')
| -rw-r--r-- | xmake/core/base/scheduler.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua index 8f3a18730..3d16a6818 100644 --- a/xmake/core/base/scheduler.lua +++ b/xmake/core/base/scheduler.lua @@ -475,8 +475,10 @@ end -- get the current running coroutine function scheduler:co_running() - local running = coroutine.running() - return running and self:co_tasks()[running] or nil + if self._ENABLED then + local running = coroutine.running() + return running and self:co_tasks()[running] or nil + end end -- get all coroutine tasks @@ -691,6 +693,11 @@ function scheduler:poller_cancel(obj) return true end +-- enable or disable to scheduler +function scheduler:enable(enabled) + self._ENABLED = enabled +end + -- stop the scheduler loop function scheduler:stop() -- mark scheduler status as stopped and spank the poller:wait() @@ -704,6 +711,7 @@ function scheduler:runloop() -- start loop self._STARTED = true + self._ENABLED = true -- ensure poller has been initialized first (for windows/iocp) and check edge-trigger mode (for epoll/kqueue) if poller:support(poller.EV_POLLER_CLEAR) then |
