HomeFreeBSD

libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.

Description

libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.

Compiler memory barriers do not prevent the CPU from executing the code
out of order. Switch to C11 atomics. This also lets us get rid of the
mutex; instead, loop until the compare_exchange succeeds.

While here, change the return value of at_quick_exit() on failure to
the more traditional -1, matching atexit().

Sponsored by: Klara, Inc.
Reviewed by: Olivier Certner, kevans, kib
Differential Revision: https://reviews.freebsd.org/D41936

Details

Provenance
desAuthored on Sep 26 2023, 8:06 PM
Reviewer
olivier
Differential Revision
D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.
Parents
rGe8a7cee67348: Add paragraph about kern.mqueue sysctls and their defaults.
Branches
Unknown
Tags
Unknown