Files
neovim/runtime/lua/uv/_meta/uv_async_t.lua
Christian Clason 0ee5a4d481 feat(meta): vendor luv meta files
Problem: No type information for `vim.uv`.

Solution: Vendor https://github.com/LuaCATS/luv (which is what
luals bundles). This will allow other tooling to work out-of-the-box and
make these files available to users and plugins without the need for
`lazydev.nvim` etc.
2025-04-10 09:13:13 +02:00

38 lines
1.1 KiB
Lua

---@meta
-- luacheck: no unused args
error('Cannot require a meta file')
--- 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 = {} -- luacheck: no unused
--- 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