LibX

Warning

This section isn't part of the official API. Things might change at any point without further notice.

Wrappers around some functionality provided by libc, libpthread, and libuv.

Index

References

ThreadPinning.uv_cpumask_sizeMethod

Returns the maximum size of the mask used for process/thread affinities, or UV_ENOTSUP if affinities are not supported on the current platform.

Ref: docs

source
ThreadPinning.uv_thread_getaffinityMethod
uv_thread_getaffinity(self_ref, cpumask, masksize)

Gets the specified thread's affinity setting. On Unix, this maps the cpu_set_t returned by pthread_getaffinity_np(3) to bytes in cpumask.

The masksize specifies the number of entries (bytes) in cpumask, and must be greater-than-or-equal-to uv_cpumask_size.

Note: Thread affinity getting is not atomic on Windows and unsupported on macOS.

Ref: docs

source
ThreadPinning.uv_thread_setaffinityMethod
uv_thread_setaffinity(self_ref, cpumask, oldmask, masksize)

Sets the specified thread's affinity to cpumask, which is specified in bytes. Optionally returning the previous affinity setting in oldmask. On Unix, uses pthread_getaffinity_np(3) 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(3). On Windows, maps the bytes in cpumask to a bitmask and uses SetThreadAffinityMask() which returns the previous affinity setting.

The masksize specifies the number of entries (bytes) in cpumask / oldmask, and must be greater-than-or-equal-to uv_cpumask_size().

Note: Thread affinity setting is not atomic on Windows and unsupported on macOS.

Ref: docs

source
ThreadPinning.gettidMethod

Returns the caller's thread ID (TID). In a single- threaded process, the thread ID is equal to the process ID (PID, as returned by getpid(2)). In a multithreaded process, all threads have the same PID, but each one has a unique TID.

Ref: docs

source