@@ -110,10 +110,10 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo
110110static void
111111__libcpp_platform_wait_on_address (__cxx_atomic_contention_t const volatile * __ptr, __cxx_contention_t __val) {
112112 // WaitOnAddress was added in Windows 8 (build 9200)
113- static auto __pWaitOnAddress = reinterpret_cast <BOOL (WINAPI*)(volatile void *, PVOID, SIZE_T, DWORD)>(
113+ static auto wait_on_address = reinterpret_cast <BOOL (WINAPI*)(volatile void *, PVOID, SIZE_T, DWORD)>(
114114 GetProcAddress (GetModuleHandleW (L" api-ms-win-core-synch-l1-2-0.dll" ), " WaitOnAddress" ));
115- if (__pWaitOnAddress != nullptr ) {
116- __pWaitOnAddress (const_cast <__cxx_atomic_contention_t *>(__ptr), &__val, sizeof (__val), INFINITE);
115+ if (wait_on_address != nullptr ) {
116+ wait_on_address (const_cast <__cxx_atomic_contention_t *>(__ptr), &__val, sizeof (__val), INFINITE);
117117 } else {
118118 __libcpp_thread_poll_with_backoff (
119119 [=]() -> bool { return !__cxx_nonatomic_compare_equal (__cxx_atomic_load (__ptr, memory_order_relaxed), __val); },
@@ -124,17 +124,23 @@ __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __pt
124124static void __libcpp_platform_wake_by_address (__cxx_atomic_contention_t const volatile * __ptr, bool __notify_one) {
125125 if (__notify_one) {
126126 // WakeByAddressSingle was added in Windows 8 (build 9200)
127- static auto __pWakeByAddressSingle = reinterpret_cast <void (WINAPI*)(PVOID)>(
127+ static auto wake_by_address_single = reinterpret_cast <void (WINAPI*)(PVOID)>(
128128 GetProcAddress (GetModuleHandleW (L" api-ms-win-core-synch-l1-2-0.dll" ), " WakeByAddressSingle" ));
129- if (__pWakeByAddressSingle != nullptr ) {
130- __pWakeByAddressSingle (const_cast <__cxx_atomic_contention_t *>(__ptr));
129+ if (wake_by_address_single != nullptr ) {
130+ wake_by_address_single (const_cast <__cxx_atomic_contention_t *>(__ptr));
131+ } else {
132+ // The fallback implementation of waking does nothing, as the fallback wait implementation just does polling, so
133+ // there's nothing to do here.
131134 }
132135 } else {
133136 // WakeByAddressAll was added in Windows 8 (build 9200)
134- static auto __pWakeByAddressAll = reinterpret_cast <void (WINAPI*)(PVOID)>(
137+ static auto wake_by_address_all = reinterpret_cast <void (WINAPI*)(PVOID)>(
135138 GetProcAddress (GetModuleHandleW (L" api-ms-win-core-synch-l1-2-0.dll" ), " WakeByAddressAll" ));
136- if (__pWakeByAddressAll != nullptr ) {
137- __pWakeByAddressAll (const_cast <__cxx_atomic_contention_t *>(__ptr));
139+ if (wake_by_address_all != nullptr ) {
140+ wake_by_address_all (const_cast <__cxx_atomic_contention_t *>(__ptr));
141+ } else {
142+ // The fallback implementation of waking does nothing, as the fallback wait implementation just does polling, so
143+ // there's nothing to do here.
138144 }
139145 }
140146}
0 commit comments