Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83079 - trunk/boost/lockfree
From: tim_at_[hidden]
Date: 2013-02-22 04:55:22


Author: timblechmann
Date: 2013-02-22 04:55:20 EST (Fri, 22 Feb 2013)
New Revision: 83079
URL: http://svn.boost.org/trac/boost/changeset/83079

Log:
lockfree: queue - allocate one element more than required

the queue internally uses a dummy node, which is not user-visible.
therefore we should allocate one element more than needed

fixes #8135

Text files modified:
   trunk/boost/lockfree/queue.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/boost/lockfree/queue.hpp
==============================================================================
--- trunk/boost/lockfree/queue.hpp (original)
+++ trunk/boost/lockfree/queue.hpp 2013-02-22 04:55:20 EST (Fri, 22 Feb 2013)
@@ -86,7 +86,7 @@
     typedef typename detail::queue_signature::bind<A0, A1, A2>::type bound_args;
 
     static const bool has_capacity = detail::extract_capacity<bound_args>::has_capacity;
- static const size_t capacity = detail::extract_capacity<bound_args>::capacity;
+ static const size_t capacity = detail::extract_capacity<bound_args>::capacity + 1; // the queue uses one dummy node
     static const bool fixed_sized = detail::extract_fixed_sized<bound_args>::value;
     static const bool node_based = !(has_capacity || fixed_sized);
     static const bool compile_time_sized = has_capacity;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk