Fixed files encoding (#46)
[libcds.git] / cds / urcu / details / base.h
index 5795d2d26119e404255dfa6d2a1e2fb433889a74..7a81b8635dfca4436eebcf9622798922e1a368f7 100644 (file)
@@ -1,9 +1,9 @@
 //$$CDS-header$$
 
-#ifndef _CDS_URCU_DETAILS_BASE_H
-#define _CDS_URCU_DETAILS_BASE_H
+#ifndef CDSLIB_URCU_DETAILS_BASE_H
+#define CDSLIB_URCU_DETAILS_BASE_H
 
-#include <cds/cxx11_atomic.h>
+#include <cds/algo/atomic.h>
 #include <cds/gc/details/retired_ptr.h>
 #include <cds/details/allocator.h>
 #include <cds/os/thread.h>
@@ -24,19 +24,17 @@ namespace cds {
         - [2011] M.Desnoyers, P.McKenney, A.Stern, M.Dagenias, J.Walpole "User-Level
           Implementations of Read-Copy Update"
 
-        <b>Informal intruduction to user-space %RCU</b>
+        <b>Informal introduction to user-space %RCU</b>
 
         [<i>From Desnoyer's papers</i>] %RCU is a synchronization mechanism that was added to the
         Linux kernel in October of 2002. %RCU achieves scalability improvements by allowing
         reads to occur concurrently with updates. In contrast to conventional locking
         primitives that ensure mutual exclusion among concurrent threads regardless of whether
         they be readers or updaters, or with reader-writer locks that allow concurrent reads
-        but not in the presence of updates, %RCU supports concurrency between a single updater
-        and multiple readers. %RCU ensures that reads are coherent by maintaining multiple
-        versions of objects and ensuring that they are not freed up until all pre-existing readside
+        but not in the presence of updates, %RCU supports concurrency between multiple updaters
+        and multiple readers. %RCU ensures that data are not freed up until all pre-existing
         critical sections complete. %RCU defines and uses efficient and scalable mechanisms
-        for publishing and reading new versions of an object, and also for deferring reclamation
-        of old versions. These mechanisms distribute the work among read and update
+        for deferring reclamation of old data. These mechanisms distribute the work among read and update
         paths in such a way as to make read paths extremely fast.
 
         %RCU readers execute within %RCU read-side critical sections. Each such critical section begins with
@@ -77,7 +75,7 @@ namespace cds {
           the best possible read-side performance, but requires that each thread periodically
           calls a function to announce that it is in a quiescent state, thus strongly
           constraining the application design. This type of %RCU is not implemented in \p libcds.
-        - The general-purpose %RCU implementation places almost no constraints on the application\92s
+        - The general-purpose %RCU implementation places almost no constraints on the application's
           design, thus being appropriate for use within a general-purpose library, but it has
           relatively higher read-side overhead. The \p libcds contains several implementations of general-purpose
           %RCU: \ref general_instant, \ref general_buffered, \ref general_threaded.
@@ -257,6 +255,7 @@ namespace cds {
 
         ///@anchor cds_urcu_retired_ptr Retired pointer, i.e. pointer that ready for reclamation
         typedef cds::gc::details::retired_ptr   retired_ptr;
+        using cds::gc::make_retired_ptr;
 
         /// Pointer to function to free (destruct and deallocate) retired pointer of specific type
         typedef cds::gc::details::free_retired_ptr_func free_retired_ptr_func;
@@ -409,19 +408,15 @@ namespace cds {
                 typedef ThreadGC                    thread_gc;
                 typedef typename thread_gc::rcu_tag rcu_tag;
 
-                bool m_bLocked;
             public:
-                scoped_lock(bool bLock = true)
-                    : m_bLocked( bLock )
+                scoped_lock()
                 {
-                    if ( bLock )
-                        thread_gc::access_lock();
+                    thread_gc::access_lock();
                 }
 
                 ~scoped_lock()
                 {
-                    if ( m_bLocked )
-                        thread_gc::access_unlock();
+                    thread_gc::access_unlock();
                 }
             };
             //@endcond
@@ -457,4 +452,4 @@ namespace cds {
     } // namespace urcu
 } // namespace cds
 
-#endif // #ifndef _CDS_URCU_DETAILS_BASE_H
+#endif // #ifndef CDSLIB_URCU_DETAILS_BASE_H