summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2019-11-06 22:40:37 +0800
committerruki <[email protected]>2019-11-06 10:03:44 +0800
commit5a30d496988936bbceee90c3e91fa235e9cf78d9 (patch)
tree508b42cea0899d9bf412cc39f4d13e418779221e /xmake
parent8e6b73d2016fd3a3bf658698e4eb10f82fbcc6f7 (diff)
add poller.wait
Diffstat (limited to 'xmake')
-rw-r--r--xmake/core/base/poller.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/xmake/core/base/poller.lua b/xmake/core/base/poller.lua
index f853c3c92..8ad0026d0 100644
--- a/xmake/core/base/poller.lua
+++ b/xmake/core/base/poller.lua
@@ -97,5 +97,22 @@ function poller:remove(sock)
return true
end
+-- wait socket events in poller
+function poller:wait(timeout)
+
+ -- wait it
+ local sockevents, count = io.poller_wait(timeout or -1)
+ if count < 0 then
+ return -1, "wait events in poller failed!"
+ end
+
+ -- TODO, wrap socket
+ if sockevents then
+ for i, v in ipairs(sockevents) do
+ end
+ end
+ return count, sockevents
+end
+
-- return module
return poller