Skip to content
Permalink
Browse files

fixed ticket 11722

  • Loading branch information...
xhabit committed Oct 17, 2015
1 parent eb21dd0 commit 14039a027433a0a9d6b5f7bfd7b54c157997ea90
@@ -1,3 +1,8 @@

// TODO: This file should no longer be required due to BOOST_LIKELY/BOOST_UNLIKELY macros; verify and remove.
// ref: https://svn.boost.org/trac/boost/ticket/11722


// branch hints
// Copyright (C) 2007, 2008 Tim Blechmann
//
@@ -12,7 +12,6 @@
#include <cstddef> /* for std::size_t */
#include <limits>

#include <boost/lockfree/detail/branch_hints.hpp>

namespace boost {
namespace lockfree {
@@ -14,7 +14,6 @@

#include <boost/cstdint.hpp>

#include <boost/lockfree/detail/branch_hints.hpp>

namespace boost {
namespace lockfree {
@@ -15,6 +15,7 @@
#include <boost/static_assert.hpp>
#include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/config.hpp> // for BOOST_LIKELY

#include <boost/lockfree/detail/atomic.hpp>
#include <boost/lockfree/detail/copy_payload.hpp>
@@ -286,8 +287,6 @@ class queue
template <bool Bounded>
bool do_push(T const & t)
{
using detail::likely;

node * n = pool.template construct<true, Bounded>(t, pool.null_handle());
handle_type node_handle = pool.get_handle(n);

@@ -301,7 +300,7 @@ class queue
node * next_ptr = pool.get_pointer(next);

tagged_node_handle tail2 = tail_.load(memory_order_acquire);
if (likely(tail == tail2)) {
if (BOOST_LIKELY(tail == tail2)) {
if (next_ptr == 0) {
tagged_node_handle new_tail_next(node_handle, next.get_next_tag());
if ( tail_node->next.compare_exchange_weak(next, new_tail_next) ) {
@@ -375,7 +374,6 @@ class queue
template <typename U>
bool pop (U & ret)
{
using detail::likely;
for (;;) {
tagged_node_handle head = head_.load(memory_order_acquire);
node * head_ptr = pool.get_pointer(head);
@@ -385,7 +383,7 @@ class queue
node * next_ptr = pool.get_pointer(next);

tagged_node_handle head2 = head_.load(memory_order_acquire);
if (likely(head == head2)) {
if (BOOST_LIKELY(head == head2)) {
if (pool.get_handle(head) == pool.get_handle(tail)) {
if (next_ptr == 0)
return false;
@@ -18,12 +18,12 @@
#include <boost/static_assert.hpp>
#include <boost/utility.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/config.hpp> // for BOOST_LIKELY

#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/type_traits/is_convertible.hpp>

#include <boost/lockfree/detail/atomic.hpp>
#include <boost/lockfree/detail/branch_hints.hpp>
#include <boost/lockfree/detail/copy_payload.hpp>
#include <boost/lockfree/detail/parameter.hpp>
#include <boost/lockfree/detail/prefix.hpp>
@@ -62,7 +62,7 @@ class ringbuffer_base
static size_t next_index(size_t arg, size_t max_size)
{
size_t ret = arg + 1;
while (unlikely(ret >= max_size))
while (BOOST_UNLIKELY(ret >= max_size))
ret -= max_size;
return ret;
}

0 comments on commit 14039a0

Please sign in to comment.
You can’t perform that action at this time.