[libcxx-commits] [libcxx] [libc++] Remove ios_base::__xindex_ from the ABI (PR #198994)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 18 09:20:37 PDT 2026
ldionne wrote:
Ok, this actually brings up a really interesting question. First, just to reframe the discussion, `_LIBCPP_HAS_THREADS` doesn't mean "single threaded mode": it means that thread facilities are not available. That's different because "single threaded mode" implies that we could drop synchronization calls. This is actually not something that's very obvious from the documentation, and in fact it's so non-obvious that we don't even follow that consistently within libc++ itself. For example, libc++abi drops synchronization in XXX when `_LIBCPP_HAS_THREADS == 0`, and that's incorrect because there could still be multiple threads of executions even if we don't ourselves provide the APIs to create them.
This is worth talking about because it seems that your use case is closer to wanting a "single threaded mode", where we assume there's only ever the current thread of execution. We don't provide that right now and I don't know if that even makes sense, but it's a possibility.
Another possibility, and that's perhaps the best path forward here since it doesn't require making a tough decision in libc++: we already provide an extension point in `libcxx/include/__atomic/support.h`. Perhaps we could have (or you could maintain downstream) a version that makes atomic non-atomic, basically. That would be like a no-op backend for libc++'s atomic facilities.
I think that would solve your immediate problem, but IDK if it would introduce new ones?
https://github.com/llvm/llvm-project/pull/198994
More information about the libcxx-commits
mailing list