Base object class for RCU-style synchronization for Athena.
More...
#include <RCUObject.h>
Base object class for RCU-style synchronization for Athena.
Definition at line 145 of file RCUObject.h.
◆ lock_t
◆ mutex_t
◆ NoObjectEnum
Value to pass to a constructor to mark that we shouldn't allocate an object.
Definition at line 150 of file RCUObject.h.
◆ IRCUObject() [1/4]
Athena::IRCUObject::IRCUObject |
( |
IRCUSvc & |
svc | ) |
|
Constructor, with RCUSvc.
- Parameters
-
svc | Service with which to register. |
The service will call quiescent
at the end of each event.
Definition at line 26 of file RCUObject.cxx.
◆ IRCUObject() [2/4]
Athena::IRCUObject::IRCUObject |
( |
size_t |
nslots | ) |
|
Constructor, with event slot count.
- Parameters
-
nslots | Number of active event slots. |
This version does not register with a service.
Definition at line 43 of file RCUObject.cxx.
◆ IRCUObject() [3/4]
Athena::IRCUObject::IRCUObject |
( |
IRCUObject && |
other | ) |
|
Move constructor.
Allow passing these objects via move.
Definition at line 70 of file RCUObject.cxx.
81 other.m_dirty =
false;
86 other.m_svc =
nullptr;
◆ IRCUObject() [4/4]
◆ ~IRCUObject()
Athena::IRCUObject::~IRCUObject |
( |
| ) |
|
|
virtual |
Destructor.
Remove this object from the service if it has been registered.
Definition at line 58 of file RCUObject.cxx.
◆ clearAll()
virtual void Athena::IRCUObject::clearAll |
( |
lock_t & |
| ) |
|
|
protectedpure virtual |
Delete all objects.
- Parameters
-
Lock | object (external locking). |
The caller must be holding the mutex for this object.
Implemented in Athena::RCUObject< T >.
◆ clearOld()
virtual bool Athena::IRCUObject::clearOld |
( |
lock_t & |
, |
|
|
size_t |
nold |
|
) |
| |
|
protectedpure virtual |
Delete old objects.
- Parameters
-
Lock | object (external locking). |
nold | Number of old objects to delete. |
The caller must be holding the mutex for this object. Returns true if there are no more objects pending deletion.
Implemented in Athena::RCUObject< T >.
◆ endGrace() [1/2]
bool Athena::IRCUObject::endGrace |
( |
lock_t & |
, |
|
|
const EventContext & |
ctx, |
|
|
boost::dynamic_bitset<> & |
grace |
|
) |
| const |
|
private |
Declare that the grace period for a slot is ending.
- Parameters
-
Lock | object (external locking). |
ctx | Event context for the slot. |
grace | Bitmask tracking grace periods. |
- Returns
- true if any slot is still in a grace period. false if no slots are in a grace period.
The caller must be holding the mutex for this object.
◆ endGrace() [2/2]
bool Athena::IRCUObject::endGrace |
( |
lock_t & |
lock, |
|
|
const EventContext & |
ctx |
|
) |
| |
|
protected |
Declare that the grace period for a slot is ending.
- Parameters
-
Lock | object (external locking). |
ctx | Event context for the slot. |
- Returns
- true if any slot is still in a grace period. false if no slots are in a grace period.
The caller must be holding the mutex for this object.
◆ makeOld()
void Athena::IRCUObject::makeOld |
( |
lock_t & |
lock, |
|
|
size_t |
garbageSize |
|
) |
| |
|
protected |
Make existing pending objects old, if possible.
- Parameters
-
lock | Lock object (external locking). |
garbageSize | Present number of objects pending deletion. |
A new object is about to be added to the list of objects pending deletion. If there are any existing pending objects and there are no existing old objects, make the current pending objects old.
◆ mutex()
mutex_t& Athena::IRCUObject::mutex |
( |
| ) |
|
|
protected |
Return the mutex for this object.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ quiescent() [1/2]
void Athena::IRCUObject::quiescent |
( |
| ) |
|
Declare the current event slot of this object to be quiescent.
This will take out a lock and possibly trigger object cleanup.
◆ quiescent() [2/2]
void Athena::IRCUObject::quiescent |
( |
const EventContext & |
ctx | ) |
|
Declare the event slot ctx
of this object to be quiescent.
- Parameters
-
This will take out a lock and possibly trigger object cleanup.
◆ setGrace()
void Athena::IRCUObject::setGrace |
( |
lock_t & |
| ) |
|
|
protected |
Declare that all slots are in a grace period.
- Parameters
-
Lock | object (external locking). |
The caller must be holding the mutex for this object.
◆ m_dirty
std::atomic<bool> Athena::IRCUObject::m_dirty |
|
private |
True if there are any objects pending deletion.
Used to avoid taking the lock in quiescent() if there's nothing to do.
Definition at line 310 of file RCUObject.h.
◆ m_grace
boost::dynamic_bitset Athena::IRCUObject::m_grace |
|
private |
Bit[i] set means that slot i is in a grace period.
Definition at line 299 of file RCUObject.h.
◆ m_mutex
std::mutex Athena::IRCUObject::m_mutex |
|
private |
The mutex for this object.
Definition at line 293 of file RCUObject.h.
◆ m_nold
size_t Athena::IRCUObject::m_nold |
|
private |
Number of old objects.
The objects at the end of the garbage list are old.
Definition at line 306 of file RCUObject.h.
◆ m_oldGrace
boost::dynamic_bitset Athena::IRCUObject::m_oldGrace |
|
private |
Same thing, for the objects marked as old.
Definition at line 302 of file RCUObject.h.
◆ m_svc
The service with which we're registered, or null.
Definition at line 296 of file RCUObject.h.
The documentation for this class was generated from the following files: