+
+
+/** Serialized RCUManager implements the RCUManager interface. It is based on the
+ following key assumption: among its users we have readers that are bound by
+ RT time constraints, and writers who are not. Therefore, we do not care how
+ slow the write_copy()/update() operations are, or what synchronization
+ primitives they use.
+
+ Because of this design assumption, this class will serialize all
+ writers. That is, objects calling write_copy()/update() will be serialized by
+ a mutex. Only a single writer may be in the middle of write_copy()/update();
+ all other writers will block until the first has finished. The order of
+ execution of multiple writers if more than one is blocked in this way is
+ undefined.
+
+ The class maintains a lock-protected "dead wood" list of old value of
+ *m_rcu_value (i.e. shared_ptr<T>). The list is cleaned up every time we call
+ write_copy(). If the list is the last instance of a shared_ptr<T> that
+ references the object (determined by shared_ptr::unique()) then we
+ erase it from the list, thus deleting the object it points to. This is lazy
+ destruction - the SerializedRCUManager assumes that there will sufficient
+ calls to write_copy() to ensure that we do not inadvertently leave objects
+ around for excessive periods of time.
+
+ For extremely well defined circumstances (i.e. it is known that there are no
+ other writer objects in existence), SerializedRCUManager also provides a
+ flush() method that will unconditionally clear out the "dead wood" list. It
+ must be used with significant caution, although the use of shared_ptr<T>
+ means that no actual objects will be deleted incorrectly if this is misused.
+*/