Home Explore Blog CI



neovim

6th chunk of `runtime/doc/luvref.txt`
090a7d90883afa4dd9ff5ca0de93b6da912ecec5995241c80000000100000fa6

                    if more callbacks are expected (meaning you should run the
                    event loop again sometime in the future).

                  - `"nowait"`: Poll for I/O once but don't block if there are
                    no pending callbacks. Returns `false` if done (no active
                    handles or requests left), or `true` if more callbacks are
                    expected (meaning you should run the event loop again
                    sometime in the future).

                Returns: `boolean` or `fail`

                Note: Luvit will implicitly call `uv.run()` after loading user
                code, but if you use the luv bindings directly, you need to
                call this after registering your initial set of event
                callbacks to start the event loop.

uv.loop_configure({option}, {...})                         *uv.loop_configure()*

                Parameters:
                - `option`: `string`
                - `...`: depends on `option`, see below

                Set additional loop options. You should normally call this
                before the first call to uv_run() unless mentioned otherwise.

                Supported options:

                  - `"block_signal"`: Block a signal when polling for new
                    events. The second argument to loop_configure() is the
                    signal name (as a lowercase string) or the signal number.
                    This operation is currently only implemented for
                    `"sigprof"` signals, to suppress unnecessary wakeups when
                    using a sampling profiler. Requesting other signals will
                    fail with `EINVAL`.
                  - `"metrics_idle_time"`: Accumulate the amount of idle time
                    the event loop spends in the event provider. This option
                    is necessary to use `metrics_idle_time()`.

                An example of a valid call to this function is:

                    >lua
                    uv.loop_configure("block_signal", "sigprof")
<

                Returns: `0` or `fail`

                Note: Be prepared to handle the `ENOSYS` error; it means the
                loop option is not supported by the platform.

uv.loop_mode()                                                  *uv.loop_mode()*

                If the loop is running, returns a string indicating the mode
                in use. If the loop is not running, `nil` is returned instead.

                Returns: `string` or `nil`

uv.loop_alive()                                                *uv.loop_alive()*

                Returns `true` if there are referenced active handles, active
                requests, or closing handles in the loop; otherwise, `false`.

                Returns: `boolean` or `fail`

uv.stop()                                                            *uv.stop()*

                Stop the event loop, causing |uv.run()| to end as soon as
                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,

Title: Event Loop Configuration and Control
Summary
This section details functions for configuring and controlling the libuv event loop. It covers `uv.loop_configure()` for setting loop options like blocking signals or enabling metrics, `uv.loop_mode()` for getting the current loop mode, `uv.loop_alive()` for checking if the loop is alive, `uv.stop()` for stopping the event loop, `uv.backend_fd()` for getting the backend file descriptor, and `uv.backend_timeout()` for getting the poll timeout.