From ffa371d6d8f9bf9da3a1be889fa22988e1a5be26 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 4 Nov 2018 00:07:53 +0800 Subject: [PATCH 01/10] build system: fix travis integration --- .travis.yml | 201 ++++++++++++++++++++++-------------------------- test/Jamfile.v2 | 8 +- 2 files changed, 98 insertions(+), 111 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a69ff9..8796080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,120 +1,105 @@ -# Use, modification, and distribution are -# subject to the Boost Software License, Version 1.0. (See accompanying -# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -# -# Copyright Rene Rivera 2015-2016. -# Copyright Tim Blechmann 2018 - -# Setting up notifications like this is optional as the default behavior -# of Travis is to notify the commiter of problems. But setting a specific -# recipient this way ensures you get all the communications about the -# builds. -notifications: - email: - recipients: - - tim@klingt.org +# Copyright 2016-2018 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +language: cpp + +sudo: false -# For now the CI scripts only support the two main branches available -# on the boost super-project. branches: only: - master - develop + - /feature\/.*/ -# We specify a generic language instead of C++ as Travis sets up -# additional environment vars that point to its default toolset -# instead of the one we install. The extra env doesn't interfere, -# but at the same time it's misleading. So to avoid confusion and -# possible unseen side effects we stick with no C++ default setup. -language: generic - -# Speficy the default as Linux here, to avoid duplication in the matrix -# below. We use Trausty as that's the latest we can use. And it's better -# supported by the whole range of C++ toolsets we like to test on. -dist: trusty -os: linux - -# Because we install our own toolsets and other software we need -# to run the sudo support. -sudo: required - -# Travis has a long standing bug with their rather complicated -# build matrix evaluation that causes empty jobs to be created. -# This global matrix entry in combination with the exclusion -# below works around that bug. This is the suggested fix from -# the Travis support people. env: matrix: - - TRAVIS_EMPTY_JOB_WORKAROUND=true + - BOGUS_JOB=true -# This lists all the toolsets we will test with the Boost CI -# scripts. Predef needs to check all of them as its job is to -# distiguish between all of them. For other libraries you would -# want to limit the list to the toolsets that are important -# for that. matrix: + exclude: - - env: TRAVIS_EMPTY_JOB_WORKAROUND=true + - env: BOGUS_JOB=true + include: - - env: TOOLSET=clang-3.4 - - env: TOOLSET=clang-3.5 - - env: TOOLSET=clang-3.6 - - env: TOOLSET=clang-3.7 - - env: TOOLSET=clang-3.8 - - env: TOOLSET=clang-3.9 - - env: TOOLSET=clang-4.0 CXXFLAGS=-std=c++03 - - env: TOOLSET=clang-4.0 CXXFLAGS=-std=c++11 - - env: TOOLSET=clang-4.0 CXXFLAGS=-std=c++14 - - env: TOOLSET=clang-4.0 CXXFLAGS=-std=c++1z - - env: TOOLSET=gcc-4.7 - - env: TOOLSET=gcc-4.8 - - env: TOOLSET=gcc-4.9 - - env: TOOLSET=gcc-5 - - env: TOOLSET=gcc-6 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=c++03 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=c++11 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=c++14 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=c++1z - - env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++03 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++11 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++14 - - env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++1z - - env: TOOLSET=xcode-6.1 - os: osx - - env: TOOLSET=xcode-6.4 - os: osx - osx_image: xcode6.4 - - env: TOOLSET=xcode-7.3 - os: osx - osx_image: xcode7.3 - - env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++03 - os: osx - osx_image: xcode8.3 - - env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++11 - os: osx - osx_image: xcode8.3 - - env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++14 - os: osx - osx_image: xcode8.3 - - env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++1z - os: osx - osx_image: xcode8.3 - -# These are the standard steps to bootstrap the Boost CI scripts -# and to forward the actions to the scripts. -before_install: - # Fetch the scripts to do the actual building/testing. - - | - wget "https://raw.githubusercontent.com/boostorg/regression/develop/ci/src/ci_boost_common.py" -P .. - wget "https://raw.githubusercontent.com/boostorg/regression/develop/ci/src/ci_boost_library_test.py" -P .. - -install: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" install -before_script: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" before_script -script: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" script -before_cache: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" before_cache -after_success: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" after_success -after_failure: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" after_failure -after_script: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" after_script -cache: - directories: - - $HOME/boostorg/boost + - os: linux + compiler: g++ + env: TOOLSET=gcc CXXSTD=03,11 + + - os: linux + compiler: g++-5 + env: TOOLSET=gcc CXXSTD=03,11,14,1z + addons: + apt: + packages: + - g++-5 + sources: + - ubuntu-toolchain-r-test + + - os: linux + compiler: g++-6 + env: TOOLSET=gcc CXXSTD=03,11,14,1z + addons: + apt: + packages: + - g++-6 + sources: + - ubuntu-toolchain-r-test + + - os: linux + compiler: g++-7 + env: TOOLSET=gcc CXXSTD=03,11,14,17 + addons: + apt: + packages: + - g++-7 + sources: + - ubuntu-toolchain-r-test + + - os: linux + compiler: g++-8 + env: TOOLSET=gcc CXXSTD=03,11,14,17 + addons: + apt: + packages: + - g++-8 + sources: + - ubuntu-toolchain-r-test + + - os: linux + compiler: clang++ + env: TOOLSET=clang CXXSTD=03,11,14,1z + + - os: linux + compiler: clang++-libc++ + env: TOOLSET=clang CXXSTD=03,11,14,1z + addons: + apt: + packages: + - libc++-dev + + - os: osx + compiler: clang++ + env: TOOLSET=clang CXXSTD=03,11,14,1z + +install: + - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true + - cd .. + - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root + - cd boost-root + - git submodule update --init tools/build + - git submodule update --init libs/config + - git submodule update --init tools/boostdep + - cp -r $TRAVIS_BUILD_DIR/* libs/lockfree + - python tools/boostdep/depinst/depinst.py lockfree + - ./bootstrap.sh + - ./b2 headers + +script: + - |- + echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam + - ./b2 -j3 libs/lockfree/test toolset=$TOOLSET cxxstd=$CXXSTD + +notifications: + email: + on_success: always diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 97bcbbf..8ce4189 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -4,14 +4,15 @@ import testing ; -lib boost_unit_test_framework ; -lib boost_thread ; +lib boost_chrono ; +lib boost_interprocess ; lib boost_system ; +lib boost_thread ; +lib boost_unit_test_framework ; project : source-location . : requirements - true ../../test/build//boost_unit_test_framework ../../atomic/build//boost_atomic ; @@ -33,6 +34,7 @@ rule test_all hpux,gcc:"-Wl,+as,mpas" ../../thread/build//boost_thread/ multi + static ] ; } From 4ef74379c2a41cd894ca77c83622274ee85ac9af Mon Sep 17 00:00:00 2001 From: liang zhou Date: Mon, 12 Nov 2018 15:25:39 +0800 Subject: [PATCH 02/10] Why modify freelist_test.cpp and test_common.hpp : In VxWorks Kernel, the re-schedule mechanism does not enable "round-robin" reschdule between the same priority tasks by default. So the case "stack_unbounded_stress_test" will lead to test case hang forever. Here's the details: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test case creates 4 tasks as “Reader”, and then 4 tasks as “Writer”, all those 8 task has the same priority 220. If the target has 2 cores, the first 2 reader tasks will occupy the cores by “while (1)” without yield, so the other 2 readers tasks and 4 writers tasks have no chance to be run. This will lead to the test case loop forever , then the exp scrip will catch it and print “RTP Execution Timeout; rebooting” The test case creates 4 tasks as “Reader”, and then 4 tasks as “Writer”, all those 8 task has the same priority 220 in VxWorks Kernel. If the target has 2 cores, the first 2 reader tasks will occupy the cores by “while (1)” without yield, so the other 2 readers tasks and 4 writers tasks have no chance to be run. This will lead to the test case loop forever without any ending. Why modify spsc_queue_stress_test.cpp : In VxWorks user-land task (Wind River calls it as RTP), the max number of objects (the internal data structure RTP uses) in one RTP is limited at most 65535. When the test is selected to run, the C++ constructor will create 1<<16 number of mutex via "new spsc_queue_tester". And after test1->run() is finished, the C++ destructor will delete 1<<16 number of mutex by default. This caused the problem, because VxWorks just support ((1<<16)-1) objects within an RTP. --- test/freelist_test.cpp | 4 ++++ test/spsc_queue_stress_test.cpp | 11 +++++++++++ test/test_common.hpp | 18 ++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/test/freelist_test.cpp b/test/freelist_test.cpp index ad8ee99..4eb9c5c 100644 --- a/test/freelist_test.cpp +++ b/test/freelist_test.cpp @@ -190,6 +190,10 @@ struct freelist_tester if (running.load() == false) break; + +#ifdef __VXWORKS__ + boost::thread::yield(); +#endif } dummy * node; diff --git a/test/spsc_queue_stress_test.cpp b/test/spsc_queue_stress_test.cpp index 399b2f3..a63afd0 100644 --- a/test/spsc_queue_stress_test.cpp +++ b/test/spsc_queue_stress_test.cpp @@ -36,7 +36,12 @@ struct spsc_queue_tester boost::lockfree::detail::atomic spsc_queue_cnt, received_nodes; +// In VxWorks one RTP just supports 65535 objects +#ifndef __VXWORKS__ static_hashed_set working_set; +#else + static_hashed_set working_set; +#endif spsc_queue_tester(void): spsc_queue_cnt(0), received_nodes(0) @@ -118,7 +123,13 @@ struct spsc_queue_tester_buffering boost::lockfree::detail::atomic spsc_queue_cnt; +// In VxWorks one RTP just supports 65535 objects +#ifndef __VXWORKS__ static_hashed_set working_set; +#else + static_hashed_set working_set; +#endif + boost::lockfree::detail::atomic received_nodes; spsc_queue_tester_buffering(void): diff --git a/test/test_common.hpp b/test/test_common.hpp index 6925fcd..2db41a8 100644 --- a/test/test_common.hpp +++ b/test/test_common.hpp @@ -51,11 +51,17 @@ struct queue_stress_tester assert(inserted); if (Bounded) - while(stk.bounded_push(id) == false) - /*thread::yield()*/; + while(stk.bounded_push(id) == false) { +#ifdef __VXWORKS__ + thread::yield(); +#endif + } else - while(stk.push(id) == false) - /*thread::yield()*/; + while(stk.push(id) == false) { +#ifdef __VXWORKS__ + thread::yield(); +#endif + } ++push_count; } writers_finished += 1; @@ -90,6 +96,10 @@ struct queue_stress_tester if ( writers_finished.load() == writer_threads ) break; + +#ifdef __VXWORKS__ + thread::yield(); +#endif } while (consume_element(q)); From e6ae845920da078119868ed98848a05dc033e509 Mon Sep 17 00:00:00 2001 From: CromwellEnage <32967088+CromwellEnage@users.noreply.github.com> Date: Thu, 22 Nov 2018 09:21:18 -0500 Subject: [PATCH 03/10] Adjust to changes in Boost.Parameter * Change include statement to reflect the fact that the boost::parameter::template_keyword class template was moved to . * Use boost::mpl::has_key vice boost::lockfree::detail::has_arg. --- include/boost/lockfree/detail/parameter.hpp | 59 ++++++++++++--------- include/boost/lockfree/policies.hpp | 2 +- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/include/boost/lockfree/detail/parameter.hpp b/include/boost/lockfree/detail/parameter.hpp index 5b0e1d7..4e8f498 100644 --- a/include/boost/lockfree/detail/parameter.hpp +++ b/include/boost/lockfree/detail/parameter.hpp @@ -13,7 +13,9 @@ #include #include -#include +#include +#include +#include #include @@ -22,25 +24,20 @@ namespace boost { namespace lockfree { namespace detail { -namespace mpl = boost::mpl; - -template -struct has_arg -{ - typedef typename parameter::binding::type type; - static const bool value = mpl::is_not_void_::type::value; -}; - - template struct extract_capacity { - static const bool has_capacity = has_arg::value; +private: + typedef typename boost::mpl::has_key::type _has_capacity; + +public: + static const bool has_capacity = _has_capacity::value; - typedef typename mpl::if_c::type, - mpl::size_t< 0 > - >::type capacity_t; + typedef typename boost::mpl::eval_if< + typename boost::mpl::has_key::type + , boost::parameter::binding + , boost::mpl::size_t< 0 > + >::type capacity_t; static const std::size_t capacity = capacity_t::value; }; @@ -49,12 +46,17 @@ struct extract_capacity template struct extract_allocator { - static const bool has_allocator = has_arg::value; +private: + typedef typename boost::mpl::has_key::type _has_allocator; - typedef typename mpl::if_c::type, - std::allocator - >::type allocator_arg; +public: + static const bool has_allocator = _has_allocator::value; + + typedef typename boost::mpl::eval_if< + typename boost::mpl::has_key::type + , boost::parameter::binding + , boost::mpl::identity > + >::type allocator_arg; typedef typename detail::allocator_rebind_helper::type type; }; @@ -62,12 +64,17 @@ struct extract_allocator template struct extract_fixed_sized { - static const bool has_fixed_sized = has_arg::value; +private: + typedef typename boost::mpl::has_key::type _has_fixed_sized; + +public: + static const bool has_fixed_sized = _has_fixed_sized::value; - typedef typename mpl::if_c::type, - mpl::bool_ - >::type type; + typedef typename mpl::eval_if< + typename boost::mpl::has_key::type + , boost::parameter::binding + , boost::mpl::bool_ + >::type type; static const bool value = type::value; }; diff --git a/include/boost/lockfree/policies.hpp b/include/boost/lockfree/policies.hpp index cf43ad2..479411e 100644 --- a/include/boost/lockfree/policies.hpp +++ b/include/boost/lockfree/policies.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_LOCKFREE_POLICIES_HPP_INCLUDED #define BOOST_LOCKFREE_POLICIES_HPP_INCLUDED -#include +#include #include #include From 86994a1b132b2667958885415e067a6496eefa6e Mon Sep 17 00:00:00 2001 From: CromwellEnage <32967088+CromwellEnage@users.noreply.github.com> Date: Fri, 23 Nov 2018 09:47:18 -0500 Subject: [PATCH 04/10] Use existing typedefs vice template reinstantiations --- include/boost/lockfree/detail/parameter.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/lockfree/detail/parameter.hpp b/include/boost/lockfree/detail/parameter.hpp index 4e8f498..9660b39 100644 --- a/include/boost/lockfree/detail/parameter.hpp +++ b/include/boost/lockfree/detail/parameter.hpp @@ -34,7 +34,7 @@ struct extract_capacity static const bool has_capacity = _has_capacity::value; typedef typename boost::mpl::eval_if< - typename boost::mpl::has_key::type + _has_capacity , boost::parameter::binding , boost::mpl::size_t< 0 > >::type capacity_t; @@ -53,7 +53,7 @@ struct extract_allocator static const bool has_allocator = _has_allocator::value; typedef typename boost::mpl::eval_if< - typename boost::mpl::has_key::type + _has_allocator , boost::parameter::binding , boost::mpl::identity > >::type allocator_arg; @@ -71,7 +71,7 @@ struct extract_fixed_sized static const bool has_fixed_sized = _has_fixed_sized::value; typedef typename mpl::eval_if< - typename boost::mpl::has_key::type + _has_fixed_sized , boost::parameter::binding , boost::mpl::bool_ >::type type; From cf3334a384b26f63043a6881f635a5c31eb35383 Mon Sep 17 00:00:00 2001 From: CromwellEnage <32967088+CromwellEnage@users.noreply.github.com> Date: Sun, 25 Nov 2018 23:36:39 -0500 Subject: [PATCH 05/10] Fix coding style --- include/boost/lockfree/detail/parameter.hpp | 29 +++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/include/boost/lockfree/detail/parameter.hpp b/include/boost/lockfree/detail/parameter.hpp index 9660b39..c6ebb1c 100644 --- a/include/boost/lockfree/detail/parameter.hpp +++ b/include/boost/lockfree/detail/parameter.hpp @@ -28,16 +28,15 @@ template struct extract_capacity { private: - typedef typename boost::mpl::has_key::type _has_capacity; + typedef typename mpl::has_key::type _has_capacity; public: static const bool has_capacity = _has_capacity::value; - typedef typename boost::mpl::eval_if< - _has_capacity - , boost::parameter::binding - , boost::mpl::size_t< 0 > - >::type capacity_t; + typedef typename mpl::eval_if<_has_capacity, + parameter::binding, + mpl::size_t< 0 > + >::type capacity_t; static const std::size_t capacity = capacity_t::value; }; @@ -52,11 +51,10 @@ struct extract_allocator public: static const bool has_allocator = _has_allocator::value; - typedef typename boost::mpl::eval_if< - _has_allocator - , boost::parameter::binding - , boost::mpl::identity > - >::type allocator_arg; + typedef typename mpl::eval_if<_has_allocator, + parameter::binding, + mpl::identity > + >::type allocator_arg; typedef typename detail::allocator_rebind_helper::type type; }; @@ -70,11 +68,10 @@ struct extract_fixed_sized public: static const bool has_fixed_sized = _has_fixed_sized::value; - typedef typename mpl::eval_if< - _has_fixed_sized - , boost::parameter::binding - , boost::mpl::bool_ - >::type type; + typedef typename mpl::eval_if<_has_fixed_sized, + parameter::binding, + mpl::bool_ + >::type type; static const bool value = type::value; }; From 38691fa3bc28faae5b669ed7d45e6ea9ef46e701 Mon Sep 17 00:00:00 2001 From: CromwellEnage <32967088+CromwellEnage@users.noreply.github.com> Date: Sun, 25 Nov 2018 23:38:47 -0500 Subject: [PATCH 06/10] Fix coding style --- include/boost/lockfree/detail/parameter.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/lockfree/detail/parameter.hpp b/include/boost/lockfree/detail/parameter.hpp index c6ebb1c..cfe23ce 100644 --- a/include/boost/lockfree/detail/parameter.hpp +++ b/include/boost/lockfree/detail/parameter.hpp @@ -46,7 +46,7 @@ template struct extract_allocator { private: - typedef typename boost::mpl::has_key::type _has_allocator; + typedef typename mpl::has_key::type _has_allocator; public: static const bool has_allocator = _has_allocator::value; @@ -63,7 +63,7 @@ template struct extract_fixed_sized { private: - typedef typename boost::mpl::has_key::type _has_fixed_sized; + typedef typename mpl::has_key::type _has_fixed_sized; public: static const bool has_fixed_sized = _has_fixed_sized::value; From 624d0053c75a8cece2aa9c7fcd7fdc6f2b6908ca Mon Sep 17 00:00:00 2001 From: CromwellEnage <32967088+CromwellEnage@users.noreply.github.com> Date: Fri, 21 Dec 2018 22:14:33 -0500 Subject: [PATCH 07/10] Update .travis.yml Update .yml scripts as per Peter Dimov's message announcing the merging of CMake into boostorg/develop. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8796080..3a325a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,6 +87,8 @@ install: - cd .. - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root - cd boost-root + - git submodule update --init tools/boost_install + - git submodule update --init libs/headers - git submodule update --init tools/build - git submodule update --init libs/config - git submodule update --init tools/boostdep From 217f8dbacbedfc7f6af6f77368938aad8266bdfc Mon Sep 17 00:00:00 2001 From: CromwellEnage <32967088+CromwellEnage@users.noreply.github.com> Date: Fri, 4 Jan 2019 11:21:02 -0500 Subject: [PATCH 08/10] Revert unnecessary changes --- include/boost/lockfree/detail/parameter.hpp | 56 ++++++++++----------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/include/boost/lockfree/detail/parameter.hpp b/include/boost/lockfree/detail/parameter.hpp index cfe23ce..5b0e1d7 100644 --- a/include/boost/lockfree/detail/parameter.hpp +++ b/include/boost/lockfree/detail/parameter.hpp @@ -13,9 +13,7 @@ #include #include -#include -#include -#include +#include #include @@ -24,19 +22,25 @@ namespace boost { namespace lockfree { namespace detail { +namespace mpl = boost::mpl; + +template +struct has_arg +{ + typedef typename parameter::binding::type type; + static const bool value = mpl::is_not_void_::type::value; +}; + + template struct extract_capacity { -private: - typedef typename mpl::has_key::type _has_capacity; - -public: - static const bool has_capacity = _has_capacity::value; + static const bool has_capacity = has_arg::value; - typedef typename mpl::eval_if<_has_capacity, - parameter::binding, - mpl::size_t< 0 > - >::type capacity_t; + typedef typename mpl::if_c::type, + mpl::size_t< 0 > + >::type capacity_t; static const std::size_t capacity = capacity_t::value; }; @@ -45,16 +49,12 @@ struct extract_capacity template struct extract_allocator { -private: - typedef typename mpl::has_key::type _has_allocator; + static const bool has_allocator = has_arg::value; -public: - static const bool has_allocator = _has_allocator::value; - - typedef typename mpl::eval_if<_has_allocator, - parameter::binding, - mpl::identity > - >::type allocator_arg; + typedef typename mpl::if_c::type, + std::allocator + >::type allocator_arg; typedef typename detail::allocator_rebind_helper::type type; }; @@ -62,16 +62,12 @@ struct extract_allocator template struct extract_fixed_sized { -private: - typedef typename mpl::has_key::type _has_fixed_sized; - -public: - static const bool has_fixed_sized = _has_fixed_sized::value; + static const bool has_fixed_sized = has_arg::value; - typedef typename mpl::eval_if<_has_fixed_sized, - parameter::binding, - mpl::bool_ - >::type type; + typedef typename mpl::if_c::type, + mpl::bool_ + >::type type; static const bool value = type::value; }; From 3d45c000b2cc0f0291e5caf7e67ed759a9917ea9 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Sun, 20 Jan 2019 19:36:28 +0200 Subject: [PATCH 09/10] fix issue #48. valgrind errors Signed-off-by: Yuval Lifshitz --- include/boost/lockfree/queue.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/lockfree/queue.hpp b/include/boost/lockfree/queue.hpp index 808bebd..2d2aa89 100644 --- a/include/boost/lockfree/queue.hpp +++ b/include/boost/lockfree/queue.hpp @@ -117,7 +117,7 @@ class queue typedef typename detail::select_tagged_handle::handle_type handle_type; node(T const & v, handle_type null_handle): - data(v)//, next(tagged_node_handle(0, 0)) + data(v), next(tagged_node_handle(null_handle, 0)) { /* increment tag to avoid ABA problem */ tagged_node_handle old_next = next.load(memory_order_relaxed); @@ -132,8 +132,8 @@ class queue node(void) {} - atomic next; T data; + atomic next; }; typedef typename detail::extract_allocator::type node_allocator; From e1fd8094947cd5b30fc5bc878e012840f9bc69a8 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Tue, 22 Jan 2019 17:14:22 +0200 Subject: [PATCH 10/10] revert back order of members Signed-off-by: Yuval Lifshitz --- include/boost/lockfree/queue.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/lockfree/queue.hpp b/include/boost/lockfree/queue.hpp index 2d2aa89..c8970bb 100644 --- a/include/boost/lockfree/queue.hpp +++ b/include/boost/lockfree/queue.hpp @@ -117,7 +117,7 @@ class queue typedef typename detail::select_tagged_handle::handle_type handle_type; node(T const & v, handle_type null_handle): - data(v), next(tagged_node_handle(null_handle, 0)) + next(tagged_node_handle(null_handle, 0)), data(v) { /* increment tag to avoid ABA problem */ tagged_node_handle old_next = next.load(memory_order_relaxed); @@ -132,8 +132,8 @@ class queue node(void) {} - T data; atomic next; + T data; }; typedef typename detail::extract_allocator::type node_allocator;