diff options
| author | ruki <[email protected]> | 2019-12-14 10:03:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-12-14 10:03:51 +0800 |
| commit | 22f2823a1b6cf40df62790e04eb770c2a6659daf (patch) | |
| tree | 0e7f2e603a04643064ff84a819708ec1c3ee49ff /xmake/core/base/socket.lua | |
| parent | 13f84aad1c1a3b5af36160f108839eae8407c555 (diff) | |
cancel socket from scheduler
Diffstat (limited to 'xmake/core/base/socket.lua')
| -rw-r--r-- | xmake/core/base/socket.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/base/socket.lua b/xmake/core/base/socket.lua index 7497d7b8a..ffae67082 100644 --- a/xmake/core/base/socket.lua +++ b/xmake/core/base/socket.lua @@ -482,7 +482,7 @@ function _instance:wait(events, timeout) local result = -1 local errors = nil if scheduler:co_running() then - result, errors = scheduler:waitsock(self, events, timeout or -1) + result, errors = scheduler:sock_wait(self, events, timeout or -1) else result, errors = io.socket_wait(self:csock(), events, timeout or -1) end @@ -501,6 +501,14 @@ function _instance:close() return false, errors end + -- cancel socket events from the scheduler + if scheduler:co_running() then + ok, errors = scheduler:sock_cancel(self) + if not ok then + return false, errors + end + end + -- close it ok = io.socket_close(self:csock()) if ok then |
