From 2da97a92417392fc25577442a7978f2fe8c421f7 Mon Sep 17 00:00:00 2001 From: khizmax Date: Mon, 2 Feb 2015 15:24:26 +0300 Subject: [PATCH] Renamed sync::injected_monitor to sync::injecting_monitor --- ...injected_monitor.h => injecting_monitor.h} | 42 +++++++++---------- cds/sync/monitor.h | 6 ++- projects/Win/vc12/cds.vcxproj | 2 +- projects/Win/vc12/cds.vcxproj.filters | 6 +-- 4 files changed, 29 insertions(+), 27 deletions(-) rename cds/sync/{injected_monitor.h => injecting_monitor.h} (63%) diff --git a/cds/sync/injected_monitor.h b/cds/sync/injecting_monitor.h similarity index 63% rename from cds/sync/injected_monitor.h rename to cds/sync/injecting_monitor.h index 17fbf666..7991fe2a 100644 --- a/cds/sync/injected_monitor.h +++ b/cds/sync/injecting_monitor.h @@ -1,7 +1,9 @@ //$$CDS-header$$ -#ifndef CDSLIB_SYNC_INJECTED_MONITOR_H -#define CDSLIB_SYNC_INJECTED_MONITOR_H +#ifndef CDSLIB_SYNC_INJECTING_MONITOR_H +#define CDSLIB_SYNC_INJECTING_MONITOR_H + +#include namespace cds { namespace sync { @@ -12,20 +14,18 @@ namespace cds { namespace sync { Template arguments: - Lock - lock type like \p std::mutex or \p cds::sync::spin - - */ template - class injected_monitor + class injecting_monitor { public: typedef Lock lock_type; ///< Lock type - /// Monitor injection into \p T - template - struct wrapper : public T + /// Monitor injection into \p Node + template + struct node_wrapper : public Node { - using T::T; + using Node::Node; mutable lock_type m_Lock; ///< Node-level lock /// Makes exclusive access to the object @@ -41,41 +41,41 @@ namespace cds { namespace sync { } }; - /// Makes exclusive access to node \p p of type \p T + /// Makes exclusive access to node \p p /** \p p must have method \p lock() */ - template - void lock( T const& p ) const + template + void lock( Node const& p ) const { p.lock(); } - /// Unlocks the node \p p of type \p T + /// Unlocks the node \p p /** \p p must have method \p unlock() */ - template - void unlock( T const& p ) const + template + void unlock( Node const& p ) const { p.unlock(); } /// Scoped lock - template + template class scoped_lock { - T const& m_Locked; ///< Our locked node + Node 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 ) + /// Makes exclusive access to node \p p + scoped_lock( injecting_monitor const&, Node const& p ) : m_Locked( p ) { p.lock(); } - /// Unlocks the object + /// Unlocks the node ~scoped_lock() { p.unlock(); @@ -84,4 +84,4 @@ namespace cds { namespace sync { }; }} // namespace cds::sync -#endif // #ifndef CDSLIB_SYNC_INJECTED_MONITOR_H +#endif // #ifndef CDSLIB_SYNC_INJECTING_MONITOR_H diff --git a/cds/sync/monitor.h b/cds/sync/monitor.h index cc96d11c..00835677 100644 --- a/cds/sync/monitor.h +++ b/cds/sync/monitor.h @@ -3,6 +3,8 @@ #ifndef CDSLIB_SYNC_MONITOR_H #define CDSLIB_SYNC_MONITOR_H +#include + namespace cds { namespace sync { /** @@ -25,7 +27,7 @@ namespace cds { namespace sync { Implemetatios \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 - struct wrapper; + struct node_wrapper; // Locks the node template diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index f20dfaf6..81c05c82 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -794,7 +794,7 @@ - + diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index 205abcda..37cf189b 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -1169,9 +1169,6 @@ Header Files\cds\container - - Header Files\cds\sync - Header Files\cds\sync @@ -1181,5 +1178,8 @@ Header Files\cds\sync + + Header Files\cds\sync + \ No newline at end of file -- 2.34.1