summaryrefslogtreecommitdiff
path: root/meta/3rd/luv/library/uv_async_t.lua
diff options
context:
space:
mode:
authorMichael Martin <3277009+flrgh@users.noreply.github.com>2022-12-13 09:23:53 -0800
committerMichael Martin <3277009+flrgh@users.noreply.github.com>2022-12-13 09:23:53 -0800
commitb65fb7a406869e572a80ba9acee1e385922c8cb5 (patch)
tree17eeb8f61919ddc32216d24bb9db110dd459ad5c /meta/3rd/luv/library/uv_async_t.lua
parenta3835a08fd1736cc7c897f3e5e1779e3c85fc35a (diff)
downloadlua-language-server-b65fb7a406869e572a80ba9acee1e385922c8cb5.zip
add luv library annotations
Diffstat (limited to 'meta/3rd/luv/library/uv_async_t.lua')
-rw-r--r--meta/3rd/luv/library/uv_async_t.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/3rd/luv/library/uv_async_t.lua b/meta/3rd/luv/library/uv_async_t.lua
new file mode 100644
index 00000000..73f17e38
--- /dev/null
+++ b/meta/3rd/luv/library/uv_async_t.lua
@@ -0,0 +1,35 @@
+---@meta
+
+--- Async handles allow the user to "wakeup" the event loop and get a callback
+--- called from another thread.
+---
+--- ```lua
+--- local async
+--- async = uv.new_async(function()
+--- print("async operation ran")
+--- async:close()
+--- end)
+---
+--- async:send()
+--- ```
+---
+---@class uv.uv_async_t : uv.uv_handle_t
+---
+local async
+
+--- Wakeup the event loop and call the async handle's callback.
+---
+--- **Note**: It's safe to call this function from any thread. The callback will be
+--- called on the loop thread.
+---
+--- **Warning**: libuv will coalesce calls to `uv.async_send(async)`, that is, not
+--- every call to it will yield an execution of the callback. For example: if
+--- `uv.async_send()` is called 5 times in a row before the callback is called, the
+--- callback will only be called once. If `uv.async_send()` is called again after
+--- the callback was called, it will be called again.
+---
+---@param ... uv.threadargs
+---@return 0|nil success
+---@return uv.error.message|nil err
+---@return uv.error.name|nil err_name
+function async:send(...) end \ No newline at end of file