![]() |
ATLAS Offline Software
|
Base object class for RCU-style synchronization for Athena. More...
#include <RCUObject.h>
Public Types | |
| enum | NoObjectEnum { NoObject } |
| Value to pass to a constructor to mark that we shouldn't allocate an object. More... | |
Public Member Functions | |
| IRCUObject (IRCUSvc &svc) | |
| Constructor, with RCUSvc. | |
| IRCUObject (size_t nslots) | |
| Constructor, with event slot count. | |
| IRCUObject (IRCUObject &&other) | |
| Move constructor. | |
| IRCUObject (const IRCUObject &)=delete | |
| IRCUObject & | operator= (const IRCUObject &)=delete |
| IRCUObject & | operator= (IRCUObject &&)=delete |
| virtual | ~IRCUObject () |
| Destructor. | |
| void | quiescent () |
| Declare the current event slot of this object to be quiescent. | |
| void | quiescent (const EventContext &ctx) |
Declare the event slot ctx of this object to be quiescent. | |
Protected Types | |
| typedef std::mutex | mutex_t |
| typedef std::unique_lock< mutex_t > | lock_t |
Protected Member Functions | |
| bool | endGrace (lock_t &lock, const EventContext &ctx) |
| Declare that the grace period for a slot is ending. | |
| void | setGrace (lock_t &) |
| Declare that all slots are in a grace period. | |
| mutex_t & | mutex () |
| Return the mutex for this object. | |
| virtual void | clearAll (lock_t &)=0 |
| Delete all objects. | |
| virtual bool | clearOld (lock_t &, size_t nold)=0 |
| Delete old objects. | |
| void | makeOld (lock_t &lock, size_t garbageSize) |
| Make existing pending objects old, if possible. | |
Private Member Functions | |
| void | quiescentOol (const EventContext &ctx) |
| Out-of-line part of quiescent(). | |
Private Attributes | |
| std::mutex | m_mutex |
| The mutex for this object. | |
| IRCUSvc * | m_svc |
| The service with which we're registered, or null. | |
| std::unique_ptr< RCUObjectGraceSets > | m_graceSets |
| Holds the current and old grace period bitmasks. | |
| size_t | m_nold |
| Number of old objects. | |
| std::atomic< bool > | m_dirty |
| True if there are any objects pending deletion. | |
Base object class for RCU-style synchronization for Athena.
Definition at line 146 of file RCUObject.h.
|
protected |
Definition at line 214 of file RCUObject.h.
|
protected |
Definition at line 213 of file RCUObject.h.
Value to pass to a constructor to mark that we shouldn't allocate an object.
| Enumerator | |
|---|---|
| NoObject | |
Definition at line 151 of file RCUObject.h.
| Athena::IRCUObject::IRCUObject | ( | IRCUSvc & | svc | ) |
Constructor, with RCUSvc.
| 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.
| Athena::IRCUObject::IRCUObject | ( | size_t | nslots | ) |
Constructor, with event slot count.
| nslots | Number of active event slots. |
This version does not register with a service.
Definition at line 88 of file RCUObject.cxx.
| Athena::IRCUObject::IRCUObject | ( | IRCUObject && | other | ) |
Move constructor.
Allow passing these objects via move.
Definition at line 114 of file RCUObject.cxx.
|
delete |
|
virtual |
Destructor.
Remove this object from the service if it has been registered.
Definition at line 102 of file RCUObject.cxx.
|
protectedpure virtual |
Delete all objects.
| Lock | object (external locking). |
The caller must be holding the mutex for this object.
Implemented in Athena::RCUObject< T >, and Athena::RCUObject< InputRenameMap_t >.
|
protectedpure virtual |
Delete old objects.
| 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 >, and Athena::RCUObject< InputRenameMap_t >.
Declare that the grace period for a slot is ending.
| Lock | object (external locking). |
| ctx | Event context for the slot. |
The caller must be holding the mutex for this object.
The caller must be holding the mutex for this object.
Definition at line 165 of file RCUObject.cxx.
|
protected |
Make existing pending objects old, if possible.
| 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.
|
protected |
Return the mutex for this object.
|
delete |
|
delete |
| 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.
| void Athena::IRCUObject::quiescent | ( | const EventContext & | ctx | ) |
Declare the event slot ctx of this object to be quiescent.
| ctx | The event context. |
This will take out a lock and possibly trigger object cleanup.
|
private |
Out-of-line part of quiescent().
Definition at line 138 of file RCUObject.cxx.
|
protected |
Declare that all slots are in a grace period.
| Lock | object (external locking). |
The caller must be holding the mutex for this object.
Definition at line 177 of file RCUObject.cxx.
|
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.
|
private |
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.
|
private |
The mutex for this object.
Definition at line 285 of file RCUObject.h.
|
private |
Number of old objects.
The objects at the end of the garbage list are old.
Definition at line 296 of file RCUObject.h.
|
private |
The service with which we're registered, or null.
Definition at line 288 of file RCUObject.h.