[libcxx-commits] [libcxx] [libc++] atomic_wait refactor experiment (PR #85086)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 13 10:14:03 PDT 2024


================
@@ -120,40 +122,83 @@ static __libcpp_contention_table_entry* __libcpp_contention_state(void const vol
 /* Given an atomic to track contention and an atomic to actually wait on, which may be
    the same atomic, we try to detect contention to avoid spuriously calling the platform. */
 
-static void __libcpp_contention_notify(__cxx_atomic_contention_t volatile* __contention_state,
+static void __libcpp_contention_notify(__cxx_atomic_contention_t volatile* __waiter_count,
----------------
ldionne wrote:

I would suggest renaming the non-ABI functions that have `__libcpp` in their name to not having `__libcpp` in their name. It's not an ABI break to do that and I think it would make the code easier to read.

```
__c11_atomic_load -> this is a builtin
__atomic_load -> this is a builtin
__libcpp_atomic_load -> this is how we would normally disambiguate between a builtin and the libc++ function
__cxx_atomic_load -> this is not a convention we have, but it makes it look a lot like __c11_atomic_load (hence a builtin) IMO
```

So maybe this function should just be named `__maybe_notify_platform_state`?

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


More information about the libcxx-commits mailing list