From: khizmax Date: Mon, 2 Feb 2015 12:24:26 +0000 (+0300) Subject: Renamed sync::injected_monitor to sync::injecting_monitor X-Git-Tag: v2.1.0~305^2~81 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2da97a92417392fc25577442a7978f2fe8c421f7;p=libcds.git Renamed sync::injected_monitor to sync::injecting_monitor --- diff --git a/cds/sync/injected_monitor.h b/cds/sync/injected_monitor.h deleted file mode 100644 index 17fbf666..00000000 --- a/cds/sync/injected_monitor.h +++ /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 - class injected_monitor - { - public: - typedef Lock lock_type; ///< Lock type - - /// Monitor injection into \p T - template - 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 - 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 - void unlock( T const& p ) const - { - p.unlock(); - } - - /// Scoped lock - template - 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 index 00000000..7991fe2a --- /dev/null +++ b/cds/sync/injecting_monitor.h @@ -0,0 +1,87 @@ +//$$CDS-header$$ + +#ifndef CDSLIB_SYNC_INJECTING_MONITOR_H +#define CDSLIB_SYNC_INJECTING_MONITOR_H + +#include + +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 + class injecting_monitor + { + public: + typedef Lock lock_type; ///< Lock type + + /// Monitor injection into \p Node + template + 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 + void lock( Node const& p ) const + { + p.lock(); + } + + /// Unlocks the node \p p + /** + \p p must have method \p unlock() + */ + template + void unlock( Node const& p ) const + { + p.unlock(); + } + + /// Scoped lock + template + 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 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