X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=cds%2Fintrusive%2Fmoir_queue.h;h=9a8d12422dfe24e57cab844c846ead263153c029;hb=40a5453909484139fc270121370575632c8e9e5c;hp=0928dd220302d30c9eb4f332e0e10685c969691f;hpb=7f0bfa169a4f46f29f5bb6a29d96e1db6a41f3ed;p=libcds.git diff --git a/cds/intrusive/moir_queue.h b/cds/intrusive/moir_queue.h index 0928dd22..9a8d1242 100644 --- a/cds/intrusive/moir_queue.h +++ b/cds/intrusive/moir_queue.h @@ -1,4 +1,32 @@ -//$$CDS-header$$ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ #ifndef CDSLIB_INTRUSIVE_MOIR_QUEUE_H #define CDSLIB_INTRUSIVE_MOIR_QUEUE_H @@ -16,14 +44,14 @@ namespace cds { namespace intrusive { "Formal Verification of a practical lock-free queue algorithm" Cite from this work about difference from Michael & Scott algo: - "Our algorithm differs from Michael and Scott’s [MS98] in that we test whether \p Tail points to the header + "Our algorithm differs from Michael and Scott's [MS98] in that we test whether \p Tail points to the header node only after \p Head has been updated, so a dequeuing process reads \p Tail only once. The dequeue in [MS98] performs this test before checking whether the next pointer in the dummy node is null, which means that it reads \p Tail every time a dequeuing process loops. Under high load, when operations retry frequently, our modification will reduce the number of accesses to global memory. This modification, however, - introduces the possibility of \p Head and \p Tail “crossing”." + introduces the possibility of \p Head and \p Tail 'crossing'." - Explanation of template arguments see intrusive::MSQueue. + Explanation of template arguments see \p intrusive::MSQueue. \par Examples \code @@ -61,7 +89,7 @@ namespace cds { namespace intrusive { // MoirQueue with Hazard Pointer garbage collector, // member hook + item disposer + item counter, - // without alignment of internal queue data: + // without padding of internal queue data: struct Bar { // Your data @@ -74,7 +102,7 @@ namespace cds { namespace intrusive { typedef ci::msqueue::member_hook< offsetof(Bar, hMember), ,ci::opt::gc > hook; typedef fooDisposer disposer; typedef cds::atomicity::item_counter item_counter; - enum { aligment = cds::opt::no_special_alignment alignment }; + enum { padding = cds::opt::no_special_padding }; }; typedef ci::MoirQueue< hp_gc, Bar, barQueueTraits > barQueue; \endcode