2 * Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration.
6 * @file AthenaKernel/RCUUpdater.icc
7 * @author scott snyder <snyder@bnl.gov>
9 * @brief Implementation of Updater for RCUSvc.
18 * @param rcusvc RCU service instance.
19 * @param args Additional arguments to pass to the T constructor.
21 * Creates a new instance of T.
24 template <typename... Args>
25 RCUUpdater<T>::RCUUpdater (IRCUSvc& rcusvc, Args&&... args)
26 : m_obj (rcusvc, std::forward<Args>(args)...)
32 * @brief Install a new object.
33 * @param p The new object to install.
34 * @param ctx Current execution context.
36 * The existing object should not be deleted until it can no longer
37 * be referenced by any thread.
41 void RCUUpdater<T>::update (std::unique_ptr<T> p, const Context_t& ctx)
43 m_obj.updater(ctx).update (std::move (p));
48 * @brief Return a reference to the current object.
52 const T& RCUUpdater<T>::get() const
54 return *m_obj.reader();
59 * @brief Mark that an event slot is not referencing this object.
63 void RCUUpdater<T>::quiescent (const Context_t& ctx)
65 m_obj.quiescent (ctx);
70 * @brief Queue an object for later deletion.
71 * @param p The object to delete.
73 * The object @c p will be queued for deletion once a grace period
74 * has passed for all slots. In contrast to using @c updater,
75 * this does not change the current object. It also does not mark
76 * the current slot as having completed the grace period (so this can
77 * be called by a thread running outside of a slot context).
81 void RCUUpdater<T>::discard (std::unique_ptr<T> p)
83 m_obj.discard (std::move (p));
88 * @brief Return the current event context.
92 const typename RCUUpdater<T>::Context_t&
93 RCUUpdater<T>::defaultContext()
95 return Gaudi::Hive::currentContext();