Home Explore Blog CI



neovim

7th chunk of `runtime/doc/luvref.txt`
483926762c00fcc3a6c04ea7c6986864a9bc61b3294f245d0000000100000fa2
 possible. This will happen not sooner than the next loop
                iteration. If this function was called before blocking for
                I/O, the loop won't block for I/O on this iteration.

                Returns: Nothing.

uv.backend_fd()                                                *uv.backend_fd()*

                Get backend file descriptor. Only kqueue, epoll, and event
                ports are supported.

                This can be used in conjunction with `uv.run("nowait")` to
                poll in one thread and run the event loop's callbacks in
                another

                Returns: `integer` or `nil`

                Note: Embedding a kqueue fd in another kqueue pollset doesn't
                work on all platforms. It's not an error to add the fd but it
                never generates events.

uv.backend_timeout()                                      *uv.backend_timeout()*

                Get the poll timeout. The return value is in milliseconds, or
                -1 for no timeout.

                Returns: `integer`

uv.now()                                                              *uv.now()*

                Returns the current timestamp in milliseconds. The timestamp
                is cached at the start of the event loop tick, see
                |uv.update_time()| for details and rationale.

                The timestamp increases monotonically from some arbitrary
                point in time. Don't make assumptions about the starting
                point, you will only get disappointed.

                Returns: `integer`

                Note: Use |uv.hrtime()| if you need sub-millisecond
                granularity.

uv.update_time()                                              *uv.update_time()*

                Update the event loop's concept of "now". Libuv caches the
                current time at the start of the event loop tick in order to
                reduce the number of time-related system calls.

                You won't normally need to call this function unless you have
                callbacks that block the event loop for longer periods of
                time, where "longer" is somewhat subjective but probably on
                the order of a millisecond or more.

                Returns: Nothing.

uv.walk({callback})                                                  *uv.walk()*

                Parameters:
                - `callback`: `callable`
                  - `handle`: `userdata` for sub-type of |uv_handle_t|

                Walk the list of handles: `callback` will be executed with
                each handle.

                Returns: Nothing.

                    >lua
                    -- Example usage of uv.walk to close all handles that
                    -- aren't already closing.
                    uv.walk(function (handle)
                      if not handle:is_closing() then
                        handle:close()
                      end
                    end)
<

==============================================================================
`uv_req_t` — Base request                              *luv-base-request* *uv_req_t*

`uv_req_t` is the base type for all libuv request types.

uv.cancel({req})                                                   *uv.cancel()*

                > method form `req:cancel()`

                Parameters:
                - `req`: `userdata` for sub-type of |uv_req_t|

                Cancel a pending request. Fails if the request is executing or
                has finished executing. Only cancellation of |uv_fs_t|,
                `uv_getaddrinfo_t`, `uv_getnameinfo_t` and `uv_work_t`
                requests is currently supported.

                Returns: `0` or `fail`

uv.req_get_type({req})                                       *uv.req_get_type()*

                > method form `req:get_type()`

                Parameters:
                - `req`: `userdata` for sub-type of |uv_req_t|


Title: Event Loop Timing, Handle Walking, and Request Cancellation
Summary
This section describes functions related to event loop timing (`uv.now()`, `uv.update_time()`), walking through handles (`uv.walk()`), and canceling pending requests (`uv.cancel()`, `uv.req_get_type()`). It includes details on backend file descriptor, poll timeout, and provides examples on how to use `uv.walk()`.