History log of /libuv/src/unix/thread.c (Results 1 – 25 of 76)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 197f453b 13-Oct-2023 Julien Roncaglia

darwin: workaround apple pthread_cond_wait bug (#4166)

Under heavy workloads pthread_cond_wait on macOS can return EINVAL while
all the input parameters are correct.

As it happe

darwin: workaround apple pthread_cond_wait bug (#4166)

Under heavy workloads pthread_cond_wait on macOS can return EINVAL while
all the input parameters are correct.

As it happens due to a syscall having an errno of EBUSY we can detect it
and work around it.

Fixes: https://github.com/libuv/libuv/issues/4165

show more ...


# 964f79f7 06-Mar-2023 Jameson Nash

barrier: wait for prior out before next in (#3905)

This code would previously get confused between rounds of the barrier
being called and a thread might incorrectly get stuck (deadlock)

barrier: wait for prior out before next in (#3905)

This code would previously get confused between rounds of the barrier
being called and a thread might incorrectly get stuck (deadlock) if the
next round started before that thread had exited the current round.

Avoid that by not starting the next round in++ before out-- has reached
zero indicating that all threads have left the prior round.

And fix it that on Windows by replacing the implementation with the one
from unix. There are some awkward platform-specific redirection here
with an extra malloc that is not needed on Win32, but that will be fixed
in libuv v2.

Fixes: https://github.com/libuv/libuv/issue/3872

show more ...


# 2638237e 21-Jan-2023 James McCoy

build: add CI for OpenBSD and FreeBSD (#3548)

Fixes: https://github.com/libuv/libuv/issues/3510


# 64669fdd 15-Nov-2022 daomingq

thread: add uv_thread_getcpu() (#3803)

Add uv_thread_getcpu() api to get the cpu number on which the calling
thread is running.


# e9000066 21-Oct-2022 daomingq

thread: add support for affinity (#3774)

Backported thread affinity feature and related dependency commits
from master. It will add support for those APIs: uv_cpumask_size,
uv_thread

thread: add support for affinity (#3774)

Backported thread affinity feature and related dependency commits
from master. It will add support for those APIs: uv_cpumask_size,
uv_thread_setaffinity, uv_thread_getaffinity.
The supported platforms are Linux, Freebsd, and Windows.
Empty implementations (returning UV_ENOTSUP) on non-supported platforms
(such as OS X and AIX).

show more ...


# b5fa965b 17-Jan-2022 Ben Noordhuis

unix: don't allow too small thread stack size (#3423)

uv_thread_create_ex() lets you set a stack size that is smaller than is
safe. It enforces a lower bound of PTHREAD_STACK_MIN (when t

unix: don't allow too small thread stack size (#3423)

uv_thread_create_ex() lets you set a stack size that is smaller than is
safe. It enforces a lower bound of PTHREAD_STACK_MIN (when that constant
is defined) but with musl libc that's still too small to receive signals
on.

Put the lower bound at 8192 or PTHREAD_STACK_MIN, whichever is greater.
The same restriction was already in place for the _default_ stack size.

show more ...


# e49ef4f3 09-Jul-2021 Guilherme Íscaro

darwin: fix uv_barrier race condition

Prior to this patch a race condition may occur in case a thread tries
to destroy the barrier while other awaiting threads were not notified.
Sin

darwin: fix uv_barrier race condition

Prior to this patch a race condition may occur in case a thread tries
to destroy the barrier while other awaiting threads were not notified.
Since the internal mutex and condition variables are destroyed this may
cause an undefined behavior as described by the man pages.

So in order to prevent such scenarios the detroy function will not wait
until all awaiting threads are finished before proceeding.

Fixes: https://github.com/libuv/libuv/issues/3102
PR-URL: https://github.com/libuv/libuv/pull/3162
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...


# 054a4953 13-Mar-2021 Brandon Cheng

unix: expose thread_stack_size() internally

This function will be used by `uv__fsevents_loop_init` in a future
commit to determine the initial FSEvents pthread stack size.

PR-UR

unix: expose thread_stack_size() internally

This function will be used by `uv__fsevents_loop_init` in a future
commit to determine the initial FSEvents pthread stack size.

PR-URL: https://github.com/libuv/libuv/pull/3132
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

Revision tags: v1.41.0, v1.40.0, v1.39.0, v1.38.1
# e50b631d 12-Jun-2020 gengjiawen

android: remove patch code for below 21

PR-URL: https://github.com/libuv/libuv/pull/2880
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

Revision tags: v1.38.0
# 18c7530a 14-May-2020 Ben Noordhuis

unix: don't abort when getrlimit() fails

It was reported that `getrlimit(RLIMIT_STACK)` fails on some aarch64
systems due to a glibc bug, where the getrlimit() system call wrapper
in

unix: don't abort when getrlimit() fails

It was reported that `getrlimit(RLIMIT_STACK)` fails on some aarch64
systems due to a glibc bug, where the getrlimit() system call wrapper
invokes the wrong system call.

Libuv could work around that by issuing a `prlimit(2)` system call
instead but since it can't assume that said system call is available
(it was added in Linux 2.6.36, libuv's baseline is 2.6.32) it seems
easier to just use the default 2M stack size when the call fails.

Fixes: https://github.com/nodejs/node/issues/33244
Refs: https://bugzilla.redhat.com/show_bug.cgi?id=1813089
PR-URL: https://github.com/libuv/libuv/pull/2848
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>

show more ...

Revision tags: v1.37.0, v1.36.0, v1.35.0, v1.34.2, v1.34.1, v1.34.0, v1.33.1, v1.33.0, v1.32.0, v1.31.0, v1.30.1
# 60526073 02-Jul-2019 Leon Huang

build: fix compile error with uClibc

uClibc does not have header "gnu/libc-version.h"

PR-URL: https://github.com/libuv/libuv/pull/2329
Reviewed-By: Ben Noordhuis <info@bnoordhui

build: fix compile error with uClibc

uClibc does not have header "gnu/libc-version.h"

PR-URL: https://github.com/libuv/libuv/pull/2329
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

# a5ffb50d 02-Jul-2019 Ben Noordhuis

unix: squelch -Wcast-function-type warning

PR-URL: https://github.com/libuv/libuv/pull/2346
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

Revision tags: v1.30.0
# d89bd156 07-Jun-2019 Ben Noordhuis

darwin,linux: more conservative minimum stack size

uv_thread_create() inspects min(PTHREAD_STACK_MIN, RLIMIT_STACK) to
find out the minimum allowed stack size. After spelunking through

darwin,linux: more conservative minimum stack size

uv_thread_create() inspects min(PTHREAD_STACK_MIN, RLIMIT_STACK) to
find out the minimum allowed stack size. After spelunking through
kernel and libc code, I came to the conclusion that allowing such
small stacks does not mix well with signals.

Musl's PTHREAD_STACK_MIN is 2 KB but signal handlers on many
architectures need at least 1 KB to store the signal context,
making it almost impossible to do anything on the thread without
signal delivery overflowing the stack.

Therefore, increase the lower bound to 8 KB. That corresponds to
PTHREAD_STACK_MIN + MINSIGSTKSZ on arm64, which has the largest
MINSIGSTKSZ of the architectures that musl supports.

PR-URL: https://github.com/libuv/libuv/pull/2310
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

Revision tags: v1.29.1, v1.29.0, v1.28.0
# 38bb0f5f 10-Apr-2019 Kamil Rytarowski

unix: guard use of PTHREAD_STACK_MIN

PTHREAD_STACK_MIN is an optional part of the POSIX spec and
NetBSD deliberately does not implement it as it's a variable
value in runtime.

unix: guard use of PTHREAD_STACK_MIN

PTHREAD_STACK_MIN is an optional part of the POSIX spec and
NetBSD deliberately does not implement it as it's a variable
value in runtime.

PR-URL: https://github.com/libuv/libuv/pull/2252
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

Revision tags: v1.27.0
# 53c15c09 21-Feb-2019 Andrew Paprocki

test,sunos: fix statement not reached warnings

The Studio C compiler issues a warning if there is a `return` after an
`abort()` call or an unreachable `return` after a prior `return`.

test,sunos: fix statement not reached warnings

The Studio C compiler issues a warning if there is a `return` after an
`abort()` call or an unreachable `return` after a prior `return`.

The Studio C compiler issues a warning if there is a `return` after a
prior `return`, or an endless loop (e.g., `for (;;)`) with a `return` at
the end of the function.

PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

Revision tags: v1.26.0
# 0eca049a 06-Feb-2019 Anna Henningsen

thread: allow specifying stack size for new thread

PR-URL: https://github.com/libuv/libuv/pull/2179
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé

thread: allow specifying stack size for new thread

PR-URL: https://github.com/libuv/libuv/pull/2179
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

Revision tags: v1.25.0
# 176db217 15-Jan-2019 Poul T Lomholt

openbsd: switch to libuv's barrier implementation

On OpenBSD 6.4 x86_64 the barrier_serial_thread test fails due to
OpenBSD's pthread_barrier_wait() implementation returning
PTHREAD_

openbsd: switch to libuv's barrier implementation

On OpenBSD 6.4 x86_64 the barrier_serial_thread test fails due to
OpenBSD's pthread_barrier_wait() implementation returning
PTHREAD_BARRIER_SERIAL_THREAD from the first thread that releases the
wait. Switch to libuv's internal implementation to address the issue.

Fixes: https://github.com/libuv/libuv/issues/2145
PR-URL: https://github.com/libuv/libuv/pull/2144
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

Revision tags: v1.24.1, v1.24.0, v1.23.2
# 49b8a9f1 08-Oct-2018 Ben Noordhuis

unix: signal done to last thread barrier waiter

Libuv's own thread barrier implementation signaled completion to the
first waiter that saw the threshold being reached, contrary to what

unix: signal done to last thread barrier waiter

Libuv's own thread barrier implementation signaled completion to the
first waiter that saw the threshold being reached, contrary to what
some native pthreads barrier implementations do, which is to signal
it to the _last_ waiter.

Libuv's behavior is not strictly non-conforming but it's inconvenient
because it means this snippet (that appears in the libuv documentation)
has a race condition in it:

if (uv_barrier_wait(&barrier) > 0)
uv_barrier_destroy(&barrier); // can still have waiters

This issue was discovered and fixed by Ali Ijaz Sheikh, a.k.a @ofrobots,
but some refactoring introduced conflicts in his pull request and I
didn't have the heart to ask him to redo it from scratch. :-)

PR-URL: https://github.com/libuv/libuv/pull/2019
Refs: https://github.com/libuv/libuv/pull/2003
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

# a3a601c5 08-Oct-2018 Ben Noordhuis

aix: switch to libuv's own thread barrier impl

It was pointed out that pthread_barrier_wait() behaves slightly
different from other platforms. Switch to libuv's own thread barrier
fo

aix: switch to libuv's own thread barrier impl

It was pointed out that pthread_barrier_wait() behaves slightly
different from other platforms. Switch to libuv's own thread barrier
for uniformity of behavior. Perhaps we'll do that for more platforms
in the future.

PR-URL: https://github.com/libuv/libuv/pull/2019
Refs: https://github.com/libuv/libuv/pull/2003#issuecomment-426471646
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

# 56702e08 08-Oct-2018 Ben Noordhuis

unix: rework thread barrier implementation

* dissolve include/uv/pthread-barrier.h

* use libuv mutexes and condition variables, not pthreads's

* drive-by cleanup and simpli

unix: rework thread barrier implementation

* dissolve include/uv/pthread-barrier.h

* use libuv mutexes and condition variables, not pthreads's

* drive-by cleanup and simplification enabled by the first two items

PR-URL: https://github.com/libuv/libuv/pull/2019
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

Revision tags: v1.23.1, v1.23.0, v1.22.0, v1.21.0, v1.20.3, v1.20.2
# 56220e5b 19-Apr-2018 Richard Lau

aix: guard STATIC_ASSERT for glibc work around

On 64-bit AIX `sizeof(uv_sem_t)` is 4 bytes which is not large
enough to store a pointer. AIX doesn't use glibc so the work around
intr

aix: guard STATIC_ASSERT for glibc work around

On 64-bit AIX `sizeof(uv_sem_t)` is 4 bytes which is not large
enough to store a pointer. AIX doesn't use glibc so the work around
introduced by https://github.com/libuv/libuv/pull/1795 doesn't
apply, so guard the STATIC_ASSERT so that it is only used when the
custom semaphore implementation is used.

Refs: https://github.com/nodejs/node/pull/20129
Refs: https://github.com/libuv/libuv/pull/1795
PR-URL: https://github.com/libuv/libuv/pull/1808
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

Revision tags: v1.20.1
# 1e4823ca 17-Apr-2018 John Barboza

zos: use custom semaphore

The System V semaphores on z/OS require explicit ending of the worker
threads and cleanup at process exit. The user will have to manually
cleanup these reso

zos: use custom semaphore

The System V semaphores on z/OS require explicit ending of the worker
threads and cleanup at process exit. The user will have to manually
cleanup these resources that are left behind. Instead use the custom
semaphore implementation which uses posix mutexes and condition
variables which are cleaned up automatically on process exit.

PR-URL: https://github.com/libuv/libuv/pull/1805
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

# fbd6de31 12-Apr-2018 Anna Henningsen

unix: work around glibc semaphore race condition

Hack around https://sourceware.org/bugzilla/show_bug.cgi?id=12674
by providing a custom implementation for glibc < 2.21 in terms of other

unix: work around glibc semaphore race condition

Hack around https://sourceware.org/bugzilla/show_bug.cgi?id=12674
by providing a custom implementation for glibc < 2.21 in terms of other
concurrency primitives.

The glibc implementation on these versions is inherently unsafe.
So, while libuv and Node.js support those versions, it seems to make
sense for libuv in its functionality as a platform abstraction library
to provide a working version.

Fixes: https://github.com/nodejs/node/issues/19903
PR-URL: https://github.com/libuv/libuv/pull/1795
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

Revision tags: v1.20.0, v1.19.2, v1.19.1, v1.19.0
# 1ded6690 17-Jan-2018 John Barboza

zos: fix timeout for condition variable

The pthread_cond_timedwait requires a timeout relative to the Epoch.
So don't use uv__hrtime to set the timeout because it is relative to an
a

zos: fix timeout for condition variable

The pthread_cond_timedwait requires a timeout relative to the Epoch.
So don't use uv__hrtime to set the timeout because it is relative to an
arbitrary time in the past. Use gettimeofday instead.

PR-URL: https://github.com/libuv/libuv/pull/1711
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jamie Davis <davisjam@vt.edu>

show more ...

# 89cbbc89 19-Jan-2018 Mason X

include,src: introduce UV__ERR() macro

Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno'

include,src: introduce UV__ERR() macro

Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno's (e.g. Haiku).

This commit adds a UV__ERR() macro that ensures libuv
errors are negative.

Fixes: https://github.com/libuv/help/issues/39
PR-URL: https://github.com/libuv/libuv/pull/1687
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

1234