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 146 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 151 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 72 of file RCUObject.cxx.
74 m_graceSets (std::make_unique<RCUObjectGraceSets> (
svc.getNumSlots())),
◆ 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 88 of file RCUObject.cxx.
90 m_graceSets (std::make_unique<RCUObjectGraceSets> (nslots)),
◆ IRCUObject() [3/4]
| Athena::IRCUObject::IRCUObject |
( |
IRCUObject && |
other | ) |
|
Move constructor.
Allow passing these objects via move.
Definition at line 114 of file RCUObject.cxx.
124 other.m_dirty =
false;
129 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 102 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()
| 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.
- Parameters
-
| lock | 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.
Definition at line 165 of file RCUObject.cxx.
◆ 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.
Definition at line 193 of file RCUObject.cxx.
195 if (garbageSize &&
m_nold == 0) {
◆ 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.
◆ quiescentOol()
| void Athena::IRCUObject::quiescentOol |
( |
const EventContext & |
ctx | ) |
|
|
private |
◆ 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.
Definition at line 177 of file RCUObject.cxx.
◆ 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 300 of file RCUObject.h.
◆ m_graceSets
Holds the current and old grace period bitmasks.
Split off into a separate object to reduce header dependencies.
Definition at line 292 of file RCUObject.h.
◆ m_mutex
| std::mutex Athena::IRCUObject::m_mutex |
|
private |
The mutex for this object.
Definition at line 285 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 296 of file RCUObject.h.
◆ m_svc
The service with which we're registered, or null.
Definition at line 288 of file RCUObject.h.
The documentation for this class was generated from the following files: