#include <comstl/util/acyclic_connector.hpp>
Reference counting architectures, such as COM, rely on there being no dependency cycles. A cyclic dependency is the situation where, say, object a holds a reference to object b, and object b holds a reference to object a. Since neither will release the references it holds (held on its efferent dependents) until all references to itself (held by its afferent dependents) the circle will never be broken.
COM lore thus proscribes the use of mutual references, or prescribes rigid protocols (e.g. Connection Points) for their management.
acyclic_connector is designed to help in the case where two objects need to have knowledge of each other, but not hold references on each other. It works by acting as an intermediary that each of two objects in the relationship keep informed as to their existance.
MX | The type of the mutex that will be used to provide exclusive access to the instance state during the Clear() and QueryPeer() methods. |
Member Types | |
typedef MX | mutex_type |
typedef acyclic_connector< MX > | class_type |
Construction | |
acyclic_connector (LPUNKNOWN leftPeer, IAcyclicSide **leftSide, LPUNKNOWN rightPeer, IAcyclicSide **rightSide) | |
Classes | |
class | side |