New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why do atomic<int>::wait on linux use timed futex wait? #57677
Comments
I don't think it does. |
@philnik777 please see ink, it does, even author of code answered (in PR) it does. In general code called from It's called for int from here Which is called from backoff cycle implementation The single reason why here is sleep it's because it's needed for correct implementation for types which use static entries. Another issue only int use platform wait, other 32 bit types don't use. |
Or you are talking about not Linux/macos implementation? Issue about Linux implementation macos btw probably incorrect and can wait forever for types which isn't int |
What exactly is even the issue? Is it somehow wrong, or is is inefficient? |
@philnik777 Also with atomic wait exist few other issues:
|
Yes, but it's case only for atomic which can not be natively used as futex, for an example, atomic_int8/16/64_t, for libc++ it's also all unsigned types (because it specializes only atomic_int to native futex usage). So initially issue was about why natively supported types of atomics (only one now
I referred to libc++ code care about linux overflow issue in case of table of futexes used (with this 2 seconds timeout) and doesn't care about same issue for macOS. |
https://github.com/llvm/llvm-project/blob/main/libcxx/src/atomic.cpp#L42
The text was updated successfully, but these errors were encountered: