libuv/test
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
..
fixtures win, unix: add uv_dlerror() and uv_dlerror_free() 2012-03-02 16:39:21 +01:00
benchmark-async-pummel.c src,lib: fix comments 2018-05-22 16:34:33 -04:00
benchmark-async.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
benchmark-fs-stat.c unix,windows: allow NULL loop for sync fs requests 2015-08-18 15:39:21 +02:00
benchmark-getaddrinfo.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-list.h bench: add 'million async handles' benchmark 2012-12-24 12:19:10 +01:00
benchmark-loop-count.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-million-async.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
benchmark-million-timers.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-multi-accept.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
benchmark-ping-pongs.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-pound.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-pump.c test: fix -Wstrict-prototypes warnings 2017-10-05 22:26:55 +02:00
benchmark-sizes.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-spawn.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-tcp-write-batch.c include: merge uv_tcp_connect and uv_tcp_connect6 2013-09-04 03:16:36 +02:00
benchmark-thread.c Make the thread_create benchmark not time out 2012-03-09 17:53:48 +01:00
benchmark-udp-pummel.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
blackhole-server.c tcp: uv_tcp_dualstack() 2014-01-19 23:07:42 +00:00
dns-server.c tcp: uv_tcp_dualstack() 2014-01-19 23:07:42 +00:00
echo-server.c unix,windows: allow NULL loop for sync fs requests 2015-08-18 15:39:21 +02:00
run-benchmarks.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
run-tests.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
runner-unix.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
runner-unix.h Add copyright headers, license file. 2011-04-18 11:11:30 -07:00
runner-win.c 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
runner-win.h test,mingw: don't use pragma when not on MSVC 2016-08-05 12:52:48 +01:00
runner.c test: no extra new line in skipped test output 2017-11-06 09:33:40 -05:00
runner.h src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
task.h win: move stdint-msvc2008.h to include/uv/ 2018-06-14 18:40:09 +02:00
test-active.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-async-null-cb.c sunos: fix cmpxchgi and cmpxchgl type error 2017-07-01 00:24:42 +02:00
test-async.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-barrier.c test: add uv_barrier_wait serial thread test 2018-10-08 11:14:41 +02:00
test-buf.c win,unix: uv_buf_init() accepts size_t 2018-05-23 10:13:57 -04:00
test-callback-order.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-callback-stack.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-close-fd.c unix: set non-block mode in uv_{pipe,tcp,udp}_open 2015-01-14 19:46:54 +01:00
test-close-order.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-condvar.c test: increase upper bound in condvar_5 2018-09-19 09:27:24 -04:00
test-connect-unspecified.c test: fix connect_unspecified 2018-03-08 11:37:00 +01:00
test-connection-fail.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-cwd-and-chdir.c test: fix cwd_and_chdir test on Unix 2014-12-16 08:12:46 +01:00
test-default-loop-close.c test: add test for closing and recreating default loop 2014-09-15 21:34:09 +02:00
test-delayed-accept.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-dlerror.c win: include filename in dlopen error message 2017-07-13 23:06:11 +02:00
test-eintr-handling.c Revert "unix,fs: fix for potential partial reads/writes" 2018-01-19 17:51:08 +01:00
test-embed.c Merge branch 'v1.x' 2016-09-20 00:24:14 +02:00
test-emfile.c zos: add support for new platform 2016-08-19 01:34:29 +02:00
test-env-vars.c unix: return UV_EINVAL for NULL env name 2017-03-14 08:28:46 +01:00
test-error.c src: add new error apis to prevent memory leaks 2018-07-06 19:35:21 +02:00
test-fail-always.c Benchmark runner 2011-04-19 04:47:21 +02:00
test-fork.c 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
test-fs-copyfile.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-fs-event.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-fs-poll.c unix, win: consistently null-terminate buffers 2016-03-03 09:20:41 +01:00
test-fs.c 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
test-get-currentexe.c linux: fix uv_exepath(size=1) UV_EINVAL error 2015-01-03 23:40:31 +01:00
test-get-loadavg.c test: fix -Wtautological-pointer-compare warnings 2015-11-18 22:37:16 +01:00
test-get-memory.c Tests: don't use %zu placeholder in printf statements 2012-04-11 22:54:02 +02:00
test-get-passwd.c unix,win: add gecos field to uv_passwd_t 2018-04-10 14:32:21 -04:00
test-getaddrinfo.c win: fix free() on bad input in uv_getaddrinfo() 2017-01-08 16:29:37 -05:00
test-gethostname.c unix,win: add uv_os_gethostname() 2017-05-18 10:27:47 -04:00
test-getnameinfo.c test: fix -Wtautological-pointer-compare warnings 2015-11-18 22:37:16 +01:00
test-getsockname.c unix, win: add send_queue_size and send_queue_count to uv_udp_t 2014-07-04 18:28:18 +02:00
test-getters-setters.c core: add getter/setter functions for easier ABI compat 2017-12-02 09:51:25 +01:00
test-handle-fileno.c 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
test-homedir.c test: handle root home directories 2016-04-08 11:08:46 -04:00
test-hrtime.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-idle.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-ip4-addr.c test: remove C++ style comment 2013-12-13 22:37:14 +04:00
test-ip6-addr.c 2018.02.22, Version 1.19.2 (Stable) 2018-02-24 17:04:48 +01:00
test-ipc-heavy-traffic-deadlock-bug.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-ipc-send-recv.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-ipc.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-list.h thread: support for affinity and detach 2018-11-10 18:01:50 -05:00
test-loop-alive.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-loop-close.c test: add threadpool init/teardown test 2017-12-06 23:47:38 +01:00
test-loop-configure.c linux: fix epoll_pwait() sigmask size calculation 2014-12-25 14:37:02 +01:00
test-loop-handles.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-loop-stop.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-loop-time.c windows: add uv_backend_timeout 2014-08-04 23:18:38 +02:00
test-multiple-listen.c tcp: uv_tcp_dualstack() 2014-01-19 23:07:42 +00:00
test-mutexes.c unix,win: add uv_mutex_init_recursive() 2017-10-02 10:01:09 -04:00
test-osx-select.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-pass-always.c Benchmark runner 2011-04-19 04:47:21 +02:00
test-ping-pong.c test: add vectored uv_write() ping-pong tests 2018-05-29 13:01:23 -07:00
test-pipe-bind-error.c Merge branch 'v1.x' into merge-v1 2017-07-09 13:52:50 +02:00
test-pipe-close-stdout-read-stdin.c test: fix compiler warnings 2018-09-18 11:49:58 -04:00
test-pipe-connect-error.c unix: fail with ENAMETOOLONG in uv_pipe_* 2017-05-31 14:59:05 +02:00
test-pipe-connect-multiple.c test: skip self-connecting tests on cygwin 2017-05-21 16:12:30 +02:00
test-pipe-connect-prepare.c unix: don't block for io if any io handle is primed 2015-05-12 07:37:26 +02:00
test-pipe-getsockname.c Merge branch 'v1.x' into merge-v1 2017-07-09 13:52:50 +02:00
test-pipe-pending-instances.c win: fix setting pipe pending instances after bind 2015-08-24 23:20:35 +02:00
test-pipe-sendmsg.c cygwin: disable non-functional ipc handle send 2017-05-21 16:12:28 +02:00
test-pipe-server-close.c test: skip self-connecting tests on cygwin 2017-05-21 16:12:30 +02:00
test-pipe-set-fchmod.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-pipe-set-non-blocking.c test: fix race condition in multithreaded test 2015-03-11 15:42:34 +01:00
test-platform-output.c unix,win: add gecos field to uv_passwd_t 2018-04-10 14:32:21 -04:00
test-poll-close-doesnt-corrupt-stack.c win: LEP-0005: remove uv_file 2017-07-04 23:44:16 +02:00
test-poll-close.c win: LEP-0005: remove uv_file 2017-07-04 23:44:16 +02:00
test-poll-closesocket.c win: LEP-0005: remove uv_file 2017-07-04 23:44:16 +02:00
test-poll-oob.c 2018.02.22, Version 1.19.2 (Stable) 2018-02-24 17:04:48 +01:00
test-poll.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-process-priority.c test: handle uv_os_setpriority() windows edge case 2018-09-25 20:56:37 -04:00
test-process-title-threadsafe.c test: speedup process-title-threadsafe on macOS 2018-06-05 11:30:28 -04:00
test-process-title.c cygwin: implement support for cygwin and msys2 2017-05-21 16:12:21 +02:00
test-queue-foreach-delete.c unix: fix uv_fs_event_stop() from fs_event_cb 2015-12-08 10:03:01 +01:00
test-ref.c test: factor out fsevents skip explanation 2017-05-21 16:12:08 +02:00
test-run-nowait.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-run-once.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-semaphore.c unix, windows: return error codes directly 2013-07-07 09:51:00 +02:00
test-shutdown-close.c unix, windows: make uv_is_*() always return 0 or 1 2013-09-12 13:30:06 +02:00
test-shutdown-eof.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-shutdown-twice.c unix,test: deadstore fixes 2017-04-05 09:57:20 -04:00
test-signal-multiple-loops.c src,lib: fix comments 2018-05-22 16:34:33 -04:00
test-signal.c 2018.02.22, Version 1.19.2 (Stable) 2018-02-24 17:04:48 +01:00
test-socket-buffer-size.c unix, windows: add uv_recv_buffer_size and uv_send_buffer_size 2014-08-09 11:36:35 +02:00
test-spawn.c 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
test-stdio-over-pipes.c win: LEP-0005: remove uv_file 2017-07-04 23:44:16 +02:00
test-tcp-alloc-cb-fail.c unix,win: make on_alloc_cb failures more resilient 2016-08-17 09:57:55 +02:00
test-tcp-bind6-error.c test: skip ipv6 tests when ipv6 is not supported 2014-12-29 17:14:48 +01:00
test-tcp-bind-error.c Revert "Revert "unix,tcp: avoid marking server sockets connected"" 2018-02-25 18:45:05 +01:00
test-tcp-close-accept.c test: close server before initiating new connection 2016-07-18 10:22:36 +01:00
test-tcp-close-while-connecting.c test: fix tcp_close_while_connecting CI failures 2016-10-14 01:57:15 +02:00
test-tcp-close.c tcp: uv_tcp_dualstack() 2014-01-19 23:07:42 +00:00
test-tcp-connect6-error.c include: merge uv_tcp_connect and uv_tcp_connect6 2013-09-04 03:16:36 +02:00
test-tcp-connect-error-after-write.c include: merge uv_tcp_connect and uv_tcp_connect6 2013-09-04 03:16:36 +02:00
test-tcp-connect-error.c include: merge uv_tcp_connect and uv_tcp_connect6 2013-09-04 03:16:36 +02:00
test-tcp-connect-timeout.c tests: skip some tests when network is unreachable 2015-07-13 10:28:46 +02:00
test-tcp-create-socket-early.c cygwin: implement support for cygwin and msys2 2017-05-21 16:12:21 +02:00
test-tcp-flags.c unix, windows: rename uv_run2 to uv_run 2013-01-16 23:35:29 +01:00
test-tcp-oob.c test: fix tcp_oob test flakiness 2018-02-28 21:58:56 +01:00
test-tcp-open.c test: fix warning in test-tcp-open 2018-08-16 10:28:49 +02:00
test-tcp-read-stop.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-tcp-shutdown-after-write.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-tcp-try-write.c stream: support empty uv_try_write on unix 2015-10-04 18:06:08 -04:00
test-tcp-unexpected-read.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-tcp-write-after-connect.c unix: fix tcp write after bad connect freezing 2014-08-21 16:23:43 +02:00
test-tcp-write-fail.c win, test: fix compilation warning 2015-09-29 09:57:27 +02:00
test-tcp-write-queue-order.c test: increase connection timeout to 1 second 2018-03-31 17:05:26 -04:00
test-tcp-write-to-half-open-connection.c tcp: uv_tcp_dualstack() 2014-01-19 23:07:42 +00:00
test-tcp-writealot.c test: fix test-tcp-writealot flakiness on arm 2016-09-12 08:33:41 +02:00
test-thread-affinity.c thread: support for affinity and detach 2018-11-10 18:01:50 -05:00
test-thread-equal.c unix, windows: add uv_thread_equal 2014-10-20 09:51:49 +02:00
test-thread.c win: issue memory barrier in uv_thread_join() 2017-11-20 20:59:33 +01:00
test-threadpool-cancel.c test: fix -Wformat warning 2017-02-08 12:47:50 +01:00
test-threadpool.c unix, windows: return error codes directly 2013-07-07 09:51:00 +02:00
test-timer-again.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-timer-from-check.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-timer.c win: wait for full timeout duration 2015-12-16 12:08:46 +01:00
test-tmpdir.c test: add missing copyright header 2016-03-24 13:17:31 -04:00
test-tty.c 2018.10.09, Version 1.23.2 (Stable) 2018-11-10 17:43:07 -05:00
test-udp-alloc-cb-fail.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-udp-bind.c unix, windows: do not set SO_REUSEADDR by default on udp 2014-04-02 01:21:35 +02:00
test-udp-connect.c udp: add support for UDP connected sockets 2018-09-28 22:19:46 +02:00
test-udp-create-socket-early.c cygwin: implement support for cygwin and msys2 2017-05-21 16:12:21 +02:00
test-udp-dgram-too-big.c include: merge uv_udp_send and uv_udp_send6 2013-09-04 03:17:29 +02:00
test-udp-ipv6.c test,openbsd: use RETURN_SKIP in UDP IPv6 tests 2018-04-17 11:48:55 +02:00
test-udp-multicast-interface6.c zos: fix udp ipv6 test cases 2018-05-15 11:29:06 +02:00
test-udp-multicast-interface.c test: allow multicast not permitted status 2018-01-09 14:32:35 +01:00
test-udp-multicast-join6.c 2018.08.18, Version 1.23.0 (Stable) 2018-08-24 12:33:18 +02:00
test-udp-multicast-join.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-udp-multicast-ttl.c test: allow multicast not permitted status 2018-01-09 14:32:35 +01:00
test-udp-open.c udp: add support for UDP connected sockets 2018-09-28 22:19:46 +02:00
test-udp-options.c win: allow setting udp socket options before bind 2018-06-04 09:19:06 -04:00
test-udp-send-and-recv.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-udp-send-hang-loop.c test: allow net unreachable status in udp test 2018-01-09 15:09:46 +01:00
test-udp-send-immediate.c src,test: fix idiosyncratic comment style 2018-05-29 11:56:49 -07:00
test-udp-send-unreachable.c windows: fix buffer leak after failed udp send 2014-08-28 08:41:43 +02:00
test-udp-try-send.c win,udp: implements uv_udp_try_send 2017-07-01 17:20:15 +02:00
test-walk-handles.c unix, windows: removed unused status parameter 2014-03-17 21:42:36 +01:00
test-watcher-cross-stop.c cygwin: implement support for cygwin and msys2 2017-05-21 16:12:21 +02:00
test.gyp thread: support for affinity and detach 2018-11-10 18:01:50 -05:00