11#include <condition_variable>
130 std::atomic<RCUInfos *> *ptr;
154 if (!ptr->compare_exchange_strong(
current,
next.load())) {
185 static std::condition_variable cond;
192 }
while (!cond.wait_for(lock, std::chrono::microseconds(1), [&] {
193 return cleanups.empty() && hasSyncedTo(syncRev);
228 auto fun = std::move(it->second);
RCUCleanupGuard(RCUInfos *infosIn)
uint64_t hasSyncedTo(uint64_t cutoff=UNLOCKED)
std::atomic< RCUInfos * > next
static thread_local RCUInfos infos
std::map< uint64_t, std::function< void()> > cleanups
static std::atomic< uint64_t > revision
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static std::atomic< RCUInfos * > threadInfos
We maintain a linked list of all the RCUInfos for each active thread.
static RecursiveMutex csThreadInfosDelete
static constexpr int RCU_ACTIVE_LOOP_COUNT
How many time a busy loop runs before yelding.
#define WAIT_LOCK(cs, name)