The goal of this patch is to make `atomic`'s wait functions to be reusable by `atomic_ref`. https://github.com/llvm/llvm-project/pull/76647 First, this patch is built on top of https://github.com/llvm/llvm-project/pull/80596 , to reduce the future merge conflicts. This patch made the following functions as "API"s to be used by `atomic`, `atomic_flag`, `semaphore`, `latch`, `atomic_ref` ``` __atomic_wait __atomic_wait_unless __atomic_notify_one __atomic_notify_all ``` These functions are made generic to support `atomic` type and `atomic_ref`. There are two customisation points. ``` // How to load the value from the given type (with a memory order) __atomic_load ``` ``` // what is the contention address that the platform `wait` function is going to monitor __atomic_contention_address ``` For `atomic_ref` (not implemented in this patch), the `load` and `address` function will be different, because - it does not use the "atomic abstraction layer" so the `load` operation will be some gcc builtin - the contention address will be the user's actual type that the `atomic_ref` is pointing to
8.6 KiB
8.6 KiB