History log of /dragonfly/lib/libthread_xu/thread/thr_mutex.c (Results 1 – 25 of 35)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.2.1, v6.2.0, v6.3.0, v6.0.1, v6.0.0, v6.0.0rc1, v6.1.0
# cf8046a9 08-Dec-2020 zrj <rimvydas.jasinskas@gmail.com>

pthreads: Reimplement pthread types using non polluting types.

Use __ implementation specific namespace and adjust libthread_xu.
* The pthread_addr_t type was specific only to libc_r, remove it.

pthreads: Reimplement pthread types using non polluting types.

Use __ implementation specific namespace and adjust libthread_xu.
* The pthread_addr_t type was specific only to libc_r, remove it.
* The pthread_startroutine_t typedef was never used since initial fork.
* The mutex member in struct pthread_once was for libc_r only, rename
it to __sparelibc_r void pointer to keep ABI compatibility.
* Mangle struct names using __type_s scheme to avoid collisions with
user defined types in 3rd-party software packages.
* Adjust partly publicly visible struct pthread_once members too.

show more ...


# 940be950 08-Dec-2020 zrj <rimvydas.jasinskas@gmail.com>

pthreads: Use pthread_t type in libthread_xu.

Separated from upcoming work to allow easier differentiation between
non-pointers, single and double pointers. Inclusion of thr_private.h
already pr

pthreads: Use pthread_t type in libthread_xu.

Separated from upcoming work to allow easier differentiation between
non-pointers, single and double pointers. Inclusion of thr_private.h
already provides all needed information to dereference these types.

No functional change

show more ...


Revision tags: v5.8.3, v5.8.2, v5.8.1, v5.8.0, v5.9.0, v5.8.0rc1, v5.6.3
# 4cc8110f 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Fix incorrect fork assumption

* libthread_xu assumed that the forked child process's TID would be 1,
but that is no longer the case.

* Fix the assumption and correct some comments whil

pthreads - Fix incorrect fork assumption

* libthread_xu assumed that the forked child process's TID would be 1,
but that is no longer the case.

* Fix the assumption and correct some comments while we are here.

Reported-by: zrj

show more ...


# 721505de 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
te

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.

In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.

However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.

* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.

These are extremely fast routines.

- Reentrant / Recursable

- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.

- The last sigunblockall() will immediately dispatch any blocked
signals.

- The normal signal mask is not affected by these routines.

- Does not block signals caused by synchronous traps.

- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.

* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().

* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().

These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.

show more ...


# 8b03c2a2 02-Nov-2019 zrj <rimvydas.jasinskas@gmail.com>

pthread: Fix simple hello world c++ statically linked use cases.

Can happen if locale setup is called before pthread_create() and c++
program is linked with -static -pthread. Check initialization

pthread: Fix simple hello world c++ statically linked use cases.

Can happen if locale setup is called before pthread_create() and c++
program is linked with -static -pthread. Check initialization status
in mutex and once related calls.

show more ...


# ce96aca2 02-Nov-2019 Sascha Wildner <saw@online.de>

libthread_xu: Remove local versions of 3 parameter timespec{add,sub}().

Adjust the parameter order. Comparison of preprocessed code before and
after this commit looks good.


# e7bf3f77 29-Oct-2019 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
__free), bypassing third party allocators.

* Fixes interactions

pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
__free), bypassing third party allocators.

* Fixes interactions between third party alocators and pthreads
which often cause deadlocks or other chicken-and-egg issues,
or require serious hacks to work around.

show more ...


Revision tags: v5.6.2, v5.6.1, v5.6.0, v5.6.0rc1, v5.7.0, v5.4.3, v5.4.2, v5.4.1, v5.4.0, v5.5.0, v5.4.0rc1, v5.2.2, v5.2.1, v5.2.0, v5.3.0, v5.2.0rc
# 3337d96b 03-Mar-2018 Sascha Wildner <saw@online.de>

<pthread.h>: Add missing 'const' to four functions.


# d33005aa 15-Feb-2018 Sascha Wildner <saw@online.de>

Add missing restrict qualifiers in POSIX function definitions/declarations.

This creates no further -Wrestrict warnings with gcc80 in buildworld.


Revision tags: v5.0.2
# 145205d1 25-Nov-2017 Sascha Wildner <saw@online.de>

Remove some duplicated includes.


Revision tags: v5.0.1
# fcaa7a3a 02-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
(sem and rtld) which must execute after all user atfork entities
pre-fork and bef

libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
(sem and rtld) which must execute after all user atfork entities
pre-fork and before all user atfork entities post-fork.

* Install an atfork handler for rtld-elf (also requires rtld-elf to
be updated). The handler will ensure that RTLD locks are in a sane
state prior to fork (by acquiring them), and will then release the
locks post-fork. This is the primary fix for lang/rust and cargo.

Also do not issue _thr_rtld_fini() when threading drops to 0.
Once threading has been set, rtld's pthread locks remain installed.

* Refactor thr_cond.c. Refactor condition variables to perform
according to the spec. Use a TAILQ to make pthread_cond_signal()
work exactly as described in the manual (that is, waking up only
one waiter at a time).

* Refactor thr_mutex.c. Primary instrument for debugging and
clean up. Also deal with improper EINTR handling.

* Refactor thr_fork.c. Implement the new atfork facility for
internal atfork handlers.

* Refactor thr_rwlock.c. Add debugging, cleanup.

* thr_sem.c now uses the internal atfork handler to ensure proper
ordering.

* thr_sig.c implements debugging features.

* Refactor thr_umtx.c... the low level mutex code. Store the id
for additonal verification and use an atomic lock to clear the
lock instead of an assignment. Properly ignore EINTR.

* Cleanup init_private() a bit.

* Add PTHREADS_DEBUGGING=TRUE and PTHREADS_DEBUGGING2=TRUE make
flags. The first writes out a garbage file in /tmp for all
locking operations as they occur. The second is used for
point debugging and writes out a file when signal 63 is sent
to the program.

* Add cpu_ccfence() in various places that might need it (a hack
for the moment, userland cannot currently #include
"machine/cpufunc.h").

* Should fix lang/rust and 'cargo'

show more ...


Revision tags: v5.0.0, v5.0.0rc2, v5.1.0, v5.0.0rc1, v4.8.1, v4.8.0, v4.6.2, v4.9.0, v4.8.0rc, v4.6.1
# a1f9998f 19-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Split mutex_init().

Makes it easier to see what is needed for PTHREAD_PROCESS_SHARED
support, that it is plenty..


# 8979fd9c 19-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Prefer explicit return on error.

Easier to follow the logic.


# 808e48a1 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Collect separated mutex functions.

Split and integrate them into thr_mutex.c and thr_mutexattr.c
just as it is currently in FreeBSD to reduce diffs.


# 19451dc5 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: General pre-cleanup (style, typos etc)

No functional change.


# d3b15642 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Sync copyright changes with FreeBSD.

Taken-from: FreeBSD


# b8ee06c5 22-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

<pthread.h>: Avoid namespace pollution.

Rename MUTEX_TYPE_MAX -> PTHREAD_MUTEX_TYPE_MAX to avoid clashes
with types in user source codes. Adjust all use cases.

While there, remove deprecated unused

<pthread.h>: Avoid namespace pollution.

Rename MUTEX_TYPE_MAX -> PTHREAD_MUTEX_TYPE_MAX to avoid clashes
with types in user source codes. Adjust all use cases.

While there, remove deprecated unused compat mutex types.

show more ...


Revision tags: v4.6.0, v4.6.0rc2, v4.6.0rc, v4.7.0, v4.4.3, v4.4.2, v4.4.1, v4.4.0, v4.5.0, v4.4.0rc, v4.2.4, v4.3.1, v4.2.3, v4.2.1, v4.2.0, v4.0.6, v4.3.0, v4.2.0rc, v4.0.5, v4.0.4, v4.0.3
# 146da5fc 08-Jan-2015 Michael Neumann <mneumann@ntecs.de>

Make pthread_*_destroy() more standards compliant

Function pthread_{mutex,cond,rwlock}_destroy() returned EINVAL when the
mutex/cond/rwlock was initialized statically via one of the
PTHREAD_*_INITIA

Make pthread_*_destroy() more standards compliant

Function pthread_{mutex,cond,rwlock}_destroy() returned EINVAL when the
mutex/cond/rwlock was initialized statically via one of the
PTHREAD_*_INITIALIZER macros and not being used before destruction. We now
return success (0) instead, as it would have been the case when the *_init()
function were used for initialization. This is also the behaviour Linux
exhibits.

Note that we now can no longer detect multiple calls to *_destroy(). Multiple
calls will do no harm, but return success.

While there, fix some potential null pointer derefs in cond and rwlock.

Fixes: #2763

show more ...


Revision tags: v4.0.2, v4.0.1, v4.0.0, v4.0.0rc3, v4.0.0rc2, v4.0.0rc, v4.1.0, v3.8.2, v3.8.1, v3.6.3, v3.8.0, v3.8.0rc2, v3.9.0, v3.8.0rc, v3.6.2, v3.6.1, v3.6.0, v3.7.1, v3.6.0rc, v3.7.0, v3.4.3, v3.4.2, v3.4.0, v3.4.1, v3.4.0rc, v3.5.0
# 7e34b7e0 19-Mar-2013 Markus Pfeiffer <markus.pfeiffer@morphism.de>

libthread_xu: Remove unnecessary calls to _thr_check_init()

With the previous commit it becomes unnecessary to check whether
libpthread has been initialised. This gets rid of some checks in
hot code

libthread_xu: Remove unnecessary calls to _thr_check_init()

With the previous commit it becomes unnecessary to check whether
libpthread has been initialised. This gets rid of some checks in
hot codepaths.

show more ...


Revision tags: v3.2.2, v3.2.1, v3.2.0, v3.3.0, v3.0.3, v3.0.2, v3.0.1, v3.1.0, v3.0.0
# 86d7f5d3 26-Nov-2011 John Marino <draco@marino.st>

Initial import of binutils 2.22 on the new vendor branch

Future versions of binutils will also reside on this branch rather
than continuing to create new binutils branches for each new version.


Revision tags: v2.12.0, v2.13.0, v2.10.1, v2.11.0, v2.10.0, v2.9.1, v2.8.2, v2.8.1, v2.8.0, v2.9.0, v2.6.3, v2.7.3, v2.6.2, v2.7.2, v2.7.1, v2.6.1, v2.7.0, v2.6.0, v2.5.1, v2.4.1, v2.5.0, v2.4.0, v2.3.2, v2.3.1, v2.2.1, v2.2.0, v2.3.0, v2.1.1, v2.0.1
# 8db03831 09-May-2008 Matthew Dillon <dillon@dragonflybsd.org>

Return EINVAL if a NULL pointer is passed to the mutex routines, instead
of crashing. This appears to be what the standard intended and what libc_r
does.


# f84e38f4 13-Apr-2006 David Xu <davidxu@dragonflybsd.org>

Seperate _mutex_cv_unlock from _mutex_unlock_common.


# a4472bae 07-Apr-2006 David Xu <davidxu@dragonflybsd.org>

Tweak source code a bit to make gcc to generate better code.
Update copyright.


# a8851a0f 06-Apr-2006 David Xu <davidxu@dragonflybsd.org>

Unlock recursive mutex in pthread_cond_wait, though this is arguable.


# fc71f871 06-Apr-2006 David Xu <davidxu@dragonflybsd.org>

WARNS level 4 cleanup.


12