Listing 3
// the interface of the wrapper to back-end, // synchronized collection of pointers template < class Listener, class Mutex, class BagType > class ListenersCollection { // this is a helper class that locks a given mutex // and unlocks when exiting the scope class MutexHolder { // ... }; public: void add(Listener *p); void remove(Listener *p); BagType getFrozen() const; private: BagType bag_; Mutex mutex_; };