libuv/include
Kiran Pamnany a0f7241059 thread: support for affinity and detach
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>
2018-11-10 18:01:50 -05:00
..
uv 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
uv.h thread: support for affinity and detach 2018-11-10 18:01:50 -05:00