[libc-commits] [libc] [libc] Mutex implementation for single-threaded baremetal (PR #145358)

William Huynh via libc-commits libc-commits at lists.llvm.org
Tue Jul 29 05:24:30 PDT 2025


saturn691 wrote:

Do you think it would be better to share the configuration of `LIBC_THREAD_MODE` with `LIBC_ERRNO_MODE`?
1. LIBC_ERRNO_MODE_SHARED (single thread), LIBC_ERRNO_MODE_SYSTEM (platform) and LIBC_ERRNO_MODE_EXTERNAL (external) already exist.
2. Ideally I want the `LIBC_THREAD_LOCAL` to be controlled by this build variable. Unfortunately `libcxx` includes headers directly through `shared/*` but then we can just define it in `errno.h` and include that in `shared/libc_common.h` like so: `#include <errno.h>`
3. I can't think of another mode to `LIBC_THREAD_MODE` that isn't compatible with `LIBC_ERRNO_MODE`, so we can just stick with `LIBC_ERRNO_MODE` (which deduces the Mutex type).

If you're happy with that I can redo this PR in one go.

https://github.com/llvm/llvm-project/pull/145358


More information about the libc-commits mailing list