int uv_thread_setaffinity(uv_thread_t *tid,
char *cpumask,
char *oldmask,
size_t mask_size);
Sets the specified thread's affinity to cpumask, which must be
specified in bytes. Returns the previous affinity setting in oldmask,
if provided. On Unix, uses pthread_getaffinity_np() to get the
affinity setting and maps the cpu_set_t to bytes in oldmask. Then
maps the bytes in cpumask to a cpu_set_t and uses pthread_setaffinity_np().
On Windows, maps the bytes in cpumask to a bitmask and uses
SetThreadAffinityMask() which returns the previous affinity setting.
int uv_thread_getaffinity(uv_thread_t *tid,
char *cpumask,
size_t mask_size);
Gets the specified thread's affinity setting. On Unix, maps the
cpu_set_t returned by pthread_getaffinity_np() to bytes in cpumask.
Unsupported on Windows, which doesn't have any way to get the current
affinity setting.
int uv_thread_detach(uv_thread_t *tid);
Detaches the specified thread so it will be cleaned up on exit
automatically; joining it is no longer necessary or possible. Uses
pthread_detach() on Unix and CloseHandle() on Windows.
Empty implementations (returning -ENOTSUP) on non-supported platforms
(such as OS X and AIX).
Refs: https://github.com/libuv/libuv/pull/273
Refs: https://github.com/libuv/libuv/pull/280
Refs: https://github.com/libuv/libuv/pull/597
PR-URL: https://github.com/libuv/libuv/pull/1654
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>