|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84403 - in trunk: boost/lockfree libs/lockfree/test
From: tim_at_[hidden]
Date: 2013-05-21 11:24:21
Author: timblechmann
Date: 2013-05-21 11:24:20 EDT (Tue, 21 May 2013)
New Revision: 84403
URL: http://svn.boost.org/trac/boost/changeset/84403
Log:
lockfree: fix stack::reserve
Text files modified:
trunk/boost/lockfree/stack.hpp | 4 ++--
trunk/libs/lockfree/test/queue_test.cpp | 9 +++++++++
trunk/libs/lockfree/test/stack_test.cpp | 10 ++++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
Modified: trunk/boost/lockfree/stack.hpp
==============================================================================
--- trunk/boost/lockfree/stack.hpp (original)
+++ trunk/boost/lockfree/stack.hpp 2013-05-21 11:24:20 EDT (Tue, 21 May 2013)
@@ -189,7 +189,7 @@
void reserve(size_type n)
{
BOOST_STATIC_ASSERT(!has_capacity);
- pool.reserve(n);
+ pool.template reserve<true>(n);
}
/** Allocate n nodes for freelist
@@ -201,7 +201,7 @@
void reserve_unsafe(size_type n)
{
BOOST_STATIC_ASSERT(!has_capacity);
- pool.reserve_unsafe(n);
+ pool.template reserve<false>(n);
}
/** Destroys stack, free all nodes from freelist.
Modified: trunk/libs/lockfree/test/queue_test.cpp
==============================================================================
--- trunk/libs/lockfree/test/queue_test.cpp (original)
+++ trunk/libs/lockfree/test/queue_test.cpp 2013-05-21 11:24:20 EDT (Tue, 21 May 2013)
@@ -177,3 +177,12 @@
BOOST_REQUIRE(f.empty());
}
+
+BOOST_AUTO_TEST_CASE( reserve_test )
+{
+ typedef boost::lockfree::queue< void* > memory_queue;
+
+ memory_queue ms(1);
+ ms.reserve(1);
+ ms.reserve_unsafe(1);
+}
Modified: trunk/libs/lockfree/test/stack_test.cpp
==============================================================================
--- trunk/libs/lockfree/test/stack_test.cpp (original)
+++ trunk/libs/lockfree/test/stack_test.cpp 2013-05-21 11:24:20 EDT (Tue, 21 May 2013)
@@ -160,3 +160,13 @@
BOOST_REQUIRE(f.empty());
}
+
+
+BOOST_AUTO_TEST_CASE( reserve_test )
+{
+ typedef boost::lockfree::stack< void* > memory_stack;
+
+ memory_stack ms(1);
+ ms.reserve(1);
+ ms.reserve_unsafe(1);
+}
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