Added sync::injected_monitor
authorkhizmax <libcds.dev@gmail.com>
Sat, 31 Jan 2015 14:38:07 +0000 (17:38 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sat, 31 Jan 2015 14:38:07 +0000 (17:38 +0300)
cds/sync/injected_monitor.h

index 063d90c13e6aad0a0a32898bce80b8b0799af98c..2e567aac4459abf1d36a65ce7d4944aceac72b36 100644 (file)
@@ -14,49 +14,63 @@ namespace cds { namespace sync {
     class injected_monitor
     {
     public:
-        typedef Lock lock_type;
+        typedef Lock lock_type; ///< Lock type
 
+        /// Monitor injection into \p T
         template <typename T>
         struct wrapper : public T
         {
             using T::T;
-            mutable lock_type m_Lock;
+            mutable lock_type m_Lock; ///< Node-level lock
 
+            /// Makes exclusive access to the object
             void lock() const
             {
                 m_Lock.lock;
             }
 
+            /// Unlocks the object
             void unlock() const
             {
                 m_Lock.unlock();
             }
         };
 
+        /// Makes exclusive access to node \p p of type \p T
+        /**
+            \p p must have method \p lock()
+        */
         template <typename T>
         void lock( T const& p ) const
         {
             p.lock();
         }
 
+        /// Unlocks the node \p p of type \p T
+        /**
+            \p p must have method \p unlock()
+        */
         template <typename T>
         void unlock( T const& p ) const
         {
             p.unlock();
         }
 
+        /// Scoped lock
         template <typename T>
         class scoped_lock
         {
             T const& m_Locked;
 
         public:
+            /// Makes exclusive access to object \p p of type T
             scoped_lock( injected_monitor const&, T const& p )
                 : m_Locked( p )
             {
                 p.lock();
             }
 
+            /// Unlocks the object
             ~scoped_lock()
             {
                 p.unlock();