Home Explore Blog CI



neovim

51th chunk of `runtime/doc/luvref.txt`
1e9229c53ec64163c64e5cd5fefac955a6abb26081bd044d0000000100000fa0
                until the value can be decremented by another thread
                incrementing it.

                The initial value must be a non-negative integer.

                Returns: `luv_sem_t userdata` or `fail`

                Note: A semaphore must be shared between threads, any
                `uv.sem_wait()` on a single thread that blocks will deadlock.

uv.sem_post({sem})                                               *uv.sem_post()*

                > method form `sem:post()`

                Parameters:
                - `sem`: `luv_sem_t userdata`

                Increments (unlocks) a semaphore, if the semaphore's value
                consequently becomes greater than zero then another thread
                blocked in a sem_wait call will be woken and proceed to
                decrement the semaphore.

                Returns: Nothing.

uv.sem_wait({sem})                                               *uv.sem_wait()*

                > method form `sem:wait()`

                Parameters:
                - `sem`: `luv_sem_t userdata`

                Decrements (locks) a semaphore, if the semaphore's value is
                greater than zero then the value is decremented and the call
                returns immediately. If the semaphore's value is zero then the
                call blocks until the semaphore's value rises above zero or
                the call is interrupted by a signal.

                Returns: Nothing.

uv.sem_trywait({sem})                                         *uv.sem_trywait()*

                > method form `sem:trywait()`

                Parameters:
                - `sem`: `luv_sem_t userdata`

                The same as `uv.sem_wait()` but returns immediately if the
                semaphore is not available.

                If the semaphore's value was decremented then `true` is
                returned, otherwise the semaphore has a value of zero and
                `false` is returned.

                Returns: `boolean`

==============================================================================
MISCELLANEOUS UTILITIES                            *luv-miscellaneous-utilities*

uv.exepath()                                                      *uv.exepath()*

                Returns the executable path.

                Returns: `string` or `fail`

uv.cwd()                                                              *uv.cwd()*

                Returns the current working directory.

                Returns: `string` or `fail`

uv.chdir({cwd})                                                     *uv.chdir()*

                Parameters:
                - `cwd`: `string`

                Sets the current working directory with the string `cwd`.

                Returns: `0` or `fail`

uv.get_process_title()                                  *uv.get_process_title()*

                Returns the title of the current process.

                Returns: `string` or `fail`

uv.set_process_title({title})                           *uv.set_process_title()*

                Parameters:
                - `title`: `string`

                Sets the title of the current process with the string `title`.

                Returns: `0` or `fail`

uv.get_total_memory()                                    *uv.get_total_memory()*

                Returns the current total system memory in bytes.

                Returns: `number`

uv.get_free_memory()                                      *uv.get_free_memory()*

                Returns the current free system memory in bytes.

                Returns: `number`

uv.get_constrained_memory()                        *uv.get_constrained_memory()*

                Gets the amount of memory available to the process in bytes
                based on limits imposed by the OS. If there is no such
                constraint, or the constraint is unknown, 0 is returned. Note
                that it is not unusual for this value to be less than or
     

Title: Libuv: Semaphore Operations and Miscellaneous Utilities
Summary
This section details Libuv's semaphore functions: `uv.sem_post` (increments the semaphore), `uv.sem_wait` (decrements, blocks if zero), and `uv.sem_trywait` (non-blocking decrement). It also describes miscellaneous utilities like `uv.exepath` (executable path), `uv.cwd` (current working directory), `uv.chdir` (sets working directory), `uv.get_process_title` (gets process title), `uv.set_process_title` (sets process title), `uv.get_total_memory` (total system memory), `uv.get_free_memory` (free system memory), and `uv.get_constrained_memory` (constrained memory).