118#ifndef ATHENAKERNEL_RCUOBJECT_H
119#define ATHENAKERNEL_RCUOBJECT_H
122#include "GaudiKernel/ThreadLocalContext.h"
123#include "GaudiKernel/EventContext.h"
135template <
class T>
class RCURead;
214 typedef std::unique_lock<mutex_t>
lock_t;
227 const EventContext& ctx);
326 template <
typename...
Args>
335 template <
typename...
Args>
481 operator bool()
const {
return m_obj !=
nullptr; }
603 std::unique_lock<std::mutex>
m_g;
Base object class for RCU-style synchronization for Athena.
virtual void clearAll(lock_t &)=0
Delete all objects.
IRCUObject(const IRCUObject &)=delete
void setGrace(lock_t &)
Declare that all slots are in a grace period.
void makeOld(lock_t &lock, size_t garbageSize)
Make existing pending objects old, if possible.
IRCUSvc * m_svc
The service with which we're registered, or null.
void quiescent()
Declare the current event slot of this object to be quiescent.
IRCUObject & operator=(const IRCUObject &)=delete
std::atomic< bool > m_dirty
True if there are any objects pending deletion.
IRCUObject(IRCUSvc &svc)
Constructor, with RCUSvc.
virtual bool clearOld(lock_t &, size_t nold)=0
Delete old objects.
std::unique_lock< mutex_t > lock_t
bool endGrace(lock_t &lock, const EventContext &ctx)
Declare that the grace period for a slot is ending.
NoObjectEnum
Value to pass to a constructor to mark that we shouldn't allocate an object.
std::mutex m_mutex
The mutex for this object.
void quiescent(const EventContext &ctx)
Declare the event slot ctx of this object to be quiescent.
void quiescentOol(const EventContext &ctx)
Out-of-line part of quiescent().
mutex_t & mutex()
Return the mutex for this object.
virtual ~IRCUObject()
Destructor.
std::unique_ptr< RCUObjectGraceSets > m_graceSets
Holds the current and old grace period bitmasks.
size_t m_nold
Number of old objects.
Interface for RCU service.
Wrapper object controlled by RCU synchonization.
Update_t updater(const EventContext &&ctx)=delete
RCUUpdate< InputRenameMap_t > Update_t
RCUObject(IRCUSvc &svc, NoObjectEnum)
Constructor, with RCUSvc.
RCUObject(const RCUObject &)=delete
Read_t reader() const
Return a reader for this RCUObject.
RCUReadQuiesce< InputRenameMap_t > ReadQuiesce_t
RCUObject(size_t nslots, Args &&... args)
Constructor, with number of slots.
std::atomic< const InputRenameMap_t * > m_obj
ReadQuiesce_t readerQuiesce()
Return a reader for this RCUObject.
void discard(lock_t &, std::unique_ptr< const T > p)
Queue an object for later deletion.
std::unique_ptr< InputRenameMap_t > m_objref
ReadQuiesce_t readerQuiesce(const EventContext &ctx)
Return a reader for this RCUObject.
Update_t updater(const EventContext &ctx)
Return an updater for this RCUObject.
Update_t updater()
Return an updater for this RCUObject.
std::deque< std::unique_ptr< const InputRenameMap_t > > m_garbage
void discard(std::unique_ptr< const T > p)
Queue an object for later deletion.
RCUObject & operator=(const RCUObject &)=delete
RCURead< InputRenameMap_t > Read_t
friend class RCUReadQuiesce
RCUObject(IRCUSvc &svc, Args &&... args)
Constructor, with RCUSvc.
ReadQuiesce_t readerQuiesce(const EventContext &&ctx)=delete
virtual void clearAll(lock_t &) override
Delete all objects.
virtual bool clearOld(lock_t &, size_t nold) override
Delete old objects.
RCUObject(RCUObject &&other)
Move constructor.
Helper to read data from a RCUObject.
const EventContext & m_ctx
The current event context.
RCUObject< T > & m_rcuobj
The RCUObject we're referencing.
RCUReadQuiesce(RCUObject< T > &rcuobj)
Constructor.
RCUReadQuiesce(RCUObject< T > &rcuobj, const EventContext &ctx)
Constructor.
~RCUReadQuiesce()
Destructor.
RCUReadQuiesce(RCUObject< T > &rcuobj, const EventContext &&ctx)=delete
Helper to read data from a RCUObject.
const T * operator->() const
Access data.
const T * m_obj
The data object we're reading.
RCURead(const RCUObject< T > &rcuobj)
Constructor.
const T & operator*() const
Access data.
Helper to update data in a RCUObject.
RCUUpdate(RCUObject< T > &rcuobj)
Constructor.
const T * operator->() const
Access data.
const EventContext & m_ctx
The event context.
RCUObject< T > & m_rcuobj
The object we're referencing.
RCUUpdate(RCUObject< T > &rcuobj, const EventContext &ctx)
Constructor.
void update(std::unique_ptr< T > ptr)
Publish a new version of the data object.
const T & operator*() const
Access data.
std::unique_lock< std::mutex > m_g
Lock for synchonization.
RCUUpdate(RCUObject< T > &rcuobj, const EventContext &&ctx)=delete
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....