mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 11:18:36 +12:00
Implement lf_queue<>, lf_value<>
lf_queue<>: unbound FIFO queue with dynamic linked-list lf_value<>: concurrently-assignable value readable without locking at the cost of memory (using dynamic linked list) Add atomic_t<>::compare_exchange
This commit is contained in:
parent
9e5b633779
commit
a8a8cd88a0
3 changed files with 221 additions and 5 deletions
|
@ -610,6 +610,12 @@ public:
|
|||
return atomic_storage<type>::compare_exchange(m_data, old, exch);
|
||||
}
|
||||
|
||||
// As in std::atomic
|
||||
bool compare_exchange(type& cmp_and_old, const type& exch)
|
||||
{
|
||||
return atomic_storage<type>::compare_exchange(m_data, cmp_and_old, exch);
|
||||
}
|
||||
|
||||
// Atomic operation; returns old value, or pair of old value and return value (cancel op if evaluates to false)
|
||||
template <typename F, typename RT = std::invoke_result_t<F, T&>>
|
||||
std::conditional_t<std::is_void_v<RT>, type, std::pair<type, RT>> fetch_op(F&& func)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue