Added sync_monitor option
[libcds.git] / cds / sync / injecting_monitor.h
index 7991fe2a152669e3324dc668fb643d60e71b0ed2..d7bf7c2f816ff5e6b273fd42457bfa4b61a0e90a 100644 (file)
@@ -4,6 +4,9 @@
 #define CDSLIB_SYNC_INJECTING_MONITOR_H
 
 #include <cds/sync/monitor.h>
+#ifndef CDS_CXX11_INHERITING_CTOR
+#   include <utility> // std::forward
+#endif
 
 namespace cds { namespace sync {
 
@@ -22,19 +25,26 @@ namespace cds { namespace sync {
         typedef Lock lock_type; ///< Lock type
 
         /// Monitor injection into \p Node
-        template <typename Node>
-        struct node_wrapper : public Node
+        struct node_injection
         {
+#       ifdef CDS_CXX11_INHERITING_CTOR
             using Node::Node;
+#       else
+            // Inheriting ctor emulation
+            template <typename... Args>
+            node_injection( Args&&... args )
+                : Node( std::forward<Args>( args )... )
+            {}
+#       endif
             mutable lock_type m_Lock; ///< Node-level lock
 
-            /// Makes exclusive access to the object
+            /// Makes exclusive access to the node
             void lock() const
             {
                 m_Lock.lock;
             }
 
-            /// Unlocks the object
+            /// Unlocks the node
             void unlock() const
             {
                 m_Lock.unlock();