with all the libpthread symbols in it.
This makes -lpthread behave like to -Wl,--whole-archive -lpthread.
This avoids a situation where threaded static binaries use some libc thread
stubs, which are racy.
Fixes PR lib/54001: call_once2_32, call_once2_static test cases failing on
amd64 since gcc7 import.
Suggested by Jonathan Wakely, thanks!
Use an intermediate function trampoline to workaround different function
pointer prototypes.
While there, correct scenario returning thrd_nomem from thrd_create(3).
In practice ENOMEM is rarely returned from pthread(3).
Older code worked on tested ports, but was depending on unneeded UB.
The original implementation of C11 threads(3) contained check for error
paths, but it was stripped in the calls that are documented to return
no status from an operation. Do the same in call_once(3).
Switch tss_t type from int to pthread_key_t (no functional change as
pthread_key_t was already typedefed as int).
Noted by <enh from Google>.
Use C11 _Noreturn in thrd_exit(3) instead of NetBSD specific __dead.
The former is documented in the standard as an attribute of thrd_exit(3),
the latter is more portable to pre-C11 compilers, however C11 thread
support library needs C11 compiler for TLS anyway. __dead made a little bit
more point 3 years ago than today as 3 years ago pre-C11 compilers were
more common.
C11 Thread support library is a portable threading C API between OSs,
similar to std::threads in the C++ world.
The library is implemented as a thin shim over POSIX interfaces.
NetBSD implements the API as a part of the POSIX threading library
(libpthread(3)).
C11 threads(3) are in the process of making them an integral part
of the POSIX standard. The interface has been implemented in major
OSs and used with stopgap libraries for older versions of them.
C11 threading library is already used (with a stopgap implementation)
in the NetBSD distribution in MESA.
Original implementation by myself from 2016.
ATF tests are new and cover almost all interfaces.
Proposed on tech-userlevel@.
to the pthread tsd implementation when the main thread is created.
This corrects a problem where a process created keys before libpthread
was loaded (either from the libc constructor or because libpthread
was dlopened later). This fixes a problem with jemalloc which creates
keys in the constructor.
These functions were marked as _NETBSD_SOURCE when introduced to the
sources. In fact they are regular POSIX threading functions available
since the 2001 standard. There is an older mention about alignment with
"IEEE Std 1003.1j-2000".
This corrects usage of these functions when a source code is compiled
with a POSIX namespace option.
Clang 5.0.0(svn) reports warnings on <pthread_types.h> for C99 constructs
when used with strict -std=c89.
Restrict designated initializers usage to C99 or newer code.
C89 and C++ will share the same code without extension of designated
initializers.
PR 52285
functions are used for destructors of thread_local objects.
If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.
Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.
libpthread_dbg(3) is a remnant library from the M:N thread model
(pre-NetBSD-5.0) API to introspect threads within a process and for use
of debuggers.
Currently in the 1:1 model it's not used in GDB neither in LLDB and it's
not either planned to be used. It's current function to read pthread_t
structures is realizable within a regular debugger capable to
instrospect objects within a tracee (GDB, LLDB...).
Remaining users of this API can still use this library from
pkgsrc/devel/libpthread_dbg.
Sponsored by <The NetBSD Foundation>
Add missing __restrict keyword to the first pointer parameter.
It was already used for the second argument, should not be a functional
change and generated code should be the same.
This new form is now aligned with POSIX.