Changeset View
Changeset View
Standalone View
Standalone View
src/rcu.cpp
Show All 10 Lines | |||||
#include <condition_variable> | #include <condition_variable> | ||||
std::atomic<uint64_t> RCUInfos::revision{0}; | std::atomic<uint64_t> RCUInfos::revision{0}; | ||||
thread_local RCUInfos RCUInfos::infos{}; | thread_local RCUInfos RCUInfos::infos{}; | ||||
/** | /** | ||||
* How many time a busy loop runs before yelding. | * How many time a busy loop runs before yelding. | ||||
*/ | */ | ||||
static const int RCU_ACTIVE_LOOP_COUNT = 10; | static constexpr int RCU_ACTIVE_LOOP_COUNT = 10; | ||||
/** | /** | ||||
* We maintain a linked list of all the RCUInfos for each active thread. Upon | * We maintain a linked list of all the RCUInfos for each active thread. Upon | ||||
* start, a new thread adds itself to the head of the liked list and the node is | * start, a new thread adds itself to the head of the liked list and the node is | ||||
* then removed when the threads shuts down. | * then removed when the threads shuts down. | ||||
* | * | ||||
* Insertion is fairly straightforward. The first step is to set the next | * Insertion is fairly straightforward. The first step is to set the next | ||||
* pointer of the node being inserted as the first node in the list as follow: | * pointer of the node being inserted as the first node in the list as follow: | ||||
▲ Show 20 Lines • Show All 206 Lines • Show Last 20 Lines |