`string, string` or `fail`
Returns (async version): `uv_getnameinfo_t userdata` or `fail`
==============================================================================
THREADING AND SYNCHRONIZATION UTILITIES *luv-threading-and-synchronization-utilities*
Libuv provides cross-platform implementations for multiple threading and
synchronization primitives. The API largely follows the pthreads API.
uv.new_thread([{options}, ] {entry}, {...}) *uv.new_thread()*
Parameters:
- `options`: `table` or `nil`
- `stack_size`: `integer` or `nil`
- `entry`: `function` or `string`
- `...`: `threadargs` passed to `entry`
Creates and initializes a `luv_thread_t` (not `uv_thread_t`).
Returns the Lua userdata wrapping it and asynchronously
executes `entry`, which can be either a Lua function or a
string containing Lua code or bytecode dumped from a function.
Additional arguments `...` are passed to the `entry` function
and an optional `options` table may be provided. Currently
accepted `option` fields are `stack_size`.
Returns: `luv_thread_t userdata` or `fail`
Note: unsafe, please make sure that the thread's end of life
is before Lua state is closed.
uv.thread_equal({thread}, {other_thread}) *uv.thread_equal()*
> method form `thread:equal(other_thread)`
Parameters:
- `thread`: `luv_thread_t userdata`
- `other_thread`: `luv_thread_t userdata`
Returns a boolean indicating whether two threads are the same.
This function is equivalent to the `__eq` metamethod.
Returns: `boolean`
*uv.thread_setaffinity()*
uv.thread_setaffinity({thread}, {affinity} [, {get_old_affinity}])
> method form `thread:setaffinity(affinity, [get_old_affinity])`
Parameters:
- `thread`: `luv_thread_t userdata`
- `affinity`: `table`
- `[1, 2, 3, ..., n]` : `boolean`
- `get_old_affinity`: `boolean`
Sets the specified thread's affinity setting.
`affinity` must be a table where each of the keys are a CPU
number and the values are booleans that represent whether the
`thread` should be eligible to run on that CPU. If the length
of the `affinity` table is not greater than or equal to
|uv.cpumask_size()|, any CPU numbers missing from the table
will have their affinity set to `false`. If setting the
affinity of more than |uv.cpumask_size()| CPUs is desired,
`affinity` must be an array-like table with no gaps, since
`#affinity` will be used as the `cpumask_size` if it is
greater than |uv.cpumask_size()|.
If `get_old_affinity` is `true`, the previous affinity
settings for the `thread` will be returned. Otherwise, `true`
is returned after a successful call.
Note: Thread affinity setting is not atomic on Windows.
Unsupported on macOS.
Returns: `table` or `boolean` or `fail`
- `[1, 2, 3, ..., n]` : `boolean`
uv.thread_getaffinity({thread} [, {mask_size}]) *uv.thread_getaffinity()*
> method form `thread:getaffinity([mask_size])`
Parameters:
- `thread`: `luv_thread_t userdata`
- `mask_size`: `integer`
Gets the specified thread's affinity setting.
If `mask_size` is provided, it must be greater than or equal
to `uv.cpumask_size()`.