[libc-commits] [PATCH] D79828: [libc] Add implementation of call_once from threads.h.
Fangrui Song via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu May 21 18:25:49 PDT 2020
MaskRay added a comment.
I think the logic is correct now, but my pthread_once argument persists. pthread_once provides strictly more features (pthread cancel) and people don't care about the performance of C11 call_once (nobody/few use it).
Piggybacking call_once on top of pthread_once is fine and likely favorable because this makes the code/binary sizes smaller.
================
Comment at: libc/src/threads/linux/call_once.cpp:21
+
+static constexpr unsigned int START = 0x1111;
+static constexpr unsigned int WAITING = 0x2222;
----------------
I don't think we need such special magic numbers instead of sequential 0, 1, 2, 3..
Larger immediates are slower (may require more than one insn) to load on some RISC architectures.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79828/new/
https://reviews.llvm.org/D79828
More information about the libc-commits
mailing list