Renamed sync::injected_monitor to sync::injecting_monitor
authorkhizmax <khizmax@gmail.com>
Mon, 2 Feb 2015 12:24:26 +0000 (15:24 +0300)
committerkhizmax <khizmax@gmail.com>
Mon, 2 Feb 2015 12:24:26 +0000 (15:24 +0300)
cds/sync/injected_monitor.h [deleted file]
cds/sync/injecting_monitor.h [new file with mode: 0644]
cds/sync/monitor.h
projects/Win/vc12/cds.vcxproj
projects/Win/vc12/cds.vcxproj.filters

diff --git a/cds/sync/injected_monitor.h b/cds/sync/injected_monitor.h
deleted file mode 100644 (file)
index 17fbf66..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-//$$CDS-header$$
-
-#ifndef CDSLIB_SYNC_INJECTED_MONITOR_H
-#define CDSLIB_SYNC_INJECTED_MONITOR_H
-
-namespace cds { namespace sync {
-
-    /// @ref cds_sync_monitor "Monitor" that injects the lock into each node
-    /**
-        This monitor injects the lock object of type \p Lock into each node. 
-        The monitor is designed for user-space locking primitives like \ref sync::spin_lock "spin-lock".
-
-        Template arguments:
-        - Lock - lock type like \p std::mutex or \p cds::sync::spin
-
-
-    */
-    template <typename Lock>
-    class injected_monitor
-    {
-    public:
-        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; ///< 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;  ///< Our locked node
-
-        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();
-            }
-        };
-    };
-}} // namespace cds::sync
-
-#endif // #ifndef CDSLIB_SYNC_INJECTED_MONITOR_H
diff --git a/cds/sync/injecting_monitor.h b/cds/sync/injecting_monitor.h
new file mode 100644 (file)
index 0000000..7991fe2
--- /dev/null
@@ -0,0 +1,87 @@
+//$$CDS-header$$
+
+#ifndef CDSLIB_SYNC_INJECTING_MONITOR_H
+#define CDSLIB_SYNC_INJECTING_MONITOR_H
+
+#include <cds/sync/monitor.h>
+
+namespace cds { namespace sync {
+
+    /// @ref cds_sync_monitor "Monitor" that injects the lock into each node
+    /**
+        This monitor injects the lock object of type \p Lock into each node. 
+        The monitor is designed for user-space locking primitives like \ref sync::spin_lock "spin-lock".
+
+        Template arguments:
+        - Lock - lock type like \p std::mutex or \p cds::sync::spin
+    */
+    template <typename Lock>
+    class injecting_monitor
+    {
+    public:
+        typedef Lock lock_type; ///< Lock type
+
+        /// Monitor injection into \p Node
+        template <typename Node>
+        struct node_wrapper : public Node
+        {
+            using Node::Node;
+            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
+        /**
+            \p p must have method \p lock()
+        */
+        template <typename Node>
+        void lock( Node const& p ) const
+        {
+            p.lock();
+        }
+
+        /// Unlocks the node \p p
+        /**
+            \p p must have method \p unlock()
+        */
+        template <typename Node>
+        void unlock( Node const& p ) const
+        {
+            p.unlock();
+        }
+
+        /// Scoped lock
+        template <typename Node>
+        class scoped_lock
+        {
+            Node const& m_Locked;  ///< Our locked node
+
+        public:
+            /// Makes exclusive access to node \p p
+            scoped_lock( injecting_monitor const&, Node const& p )
+                : m_Locked( p )
+            {
+                p.lock();
+            }
+
+            /// Unlocks the node
+            ~scoped_lock()
+            {
+                p.unlock();
+            }
+        };
+    };
+}} // namespace cds::sync
+
+#endif // #ifndef CDSLIB_SYNC_INJECTING_MONITOR_H
index cc96d11c8a5df8b8cd2cba769edb637fa7671df2..008356772d1af0b0482a3a757319ad10e640e8f3 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef CDSLIB_SYNC_MONITOR_H
 #define CDSLIB_SYNC_MONITOR_H
 
+#include <cds/details/defs.h>
+
 namespace cds { namespace sync {
 
     /**
@@ -25,7 +27,7 @@ namespace cds { namespace sync {
         <b>Implemetatios</b>
 
         \p libcds contains several monitor implementations:
-        - \p sync::injected_monitor injects the lock object into each node.
+        - \p sync::injecting_monitor injects the lock object into each node.
             That mock monitor is designed for user-space locking primitive like
             \ref sync::spin_lock "spin-lock".
 
@@ -43,7 +45,7 @@ namespace cds { namespace sync {
         public:
             // Monitor's injection into the Node class
             template <typename Node>
-            struct wrapper;
+            struct node_wrapper;
 
             // Locks the node 
             template <typename Node>
index f20dfaf67267592da0ce60f7eb08367dafeeda18..81c05c828c5e95d0f5990fdfe517b0ef8263182d 100644 (file)
     <ClInclude Include="..\..\..\cds\os\osx\topology.h" />\r
     <ClInclude Include="..\..\..\cds\os\posix\fake_topology.h" />\r
     <ClInclude Include="..\..\..\cds\os\posix\timer.h" />\r
-    <ClInclude Include="..\..\..\cds\sync\injected_monitor.h" />\r
+    <ClInclude Include="..\..\..\cds\sync\injecting_monitor.h" />\r
     <ClInclude Include="..\..\..\cds\sync\lock_array.h" />\r
     <ClInclude Include="..\..\..\cds\sync\monitor.h" />\r
     <ClInclude Include="..\..\..\cds\sync\spinlock.h" />\r
index 205abcda4a272b0df955feacea06eb6bcd03a447..37cf189becd0bc2d951d5c68351dc1d3f2c2de1c 100644 (file)
     <ClInclude Include="..\..\..\cds\container\bronson_avltree_map_rcu.h">\r
       <Filter>Header Files\cds\container</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\..\cds\sync\injected_monitor.h">\r
-      <Filter>Header Files\cds\sync</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\..\cds\sync\spinlock.h">\r
       <Filter>Header Files\cds\sync</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\cds\sync\monitor.h">\r
       <Filter>Header Files\cds\sync</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\cds\sync\injecting_monitor.h">\r
+      <Filter>Header Files\cds\sync</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file