+++ /dev/null
-//$$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
--- /dev/null
+//$$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
#ifndef CDSLIB_SYNC_MONITOR_H
#define CDSLIB_SYNC_MONITOR_H
+#include <cds/details/defs.h>
+
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".
public:
// Monitor's injection into the Node class
template <typename Node>
- struct wrapper;
+ struct node_wrapper;
// Locks the node
template <typename Node>
<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
<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