Boost logo

Boost :

Subject: Re: [boost] [atomic, x86] need another pair of eyes
From: Tim Blechmann (tim_at_[hidden])
Date: 2012-12-19 06:34:38

hi andrey and peter,

to be more specific: of the test machines at sandia sometimes has test
failures for boost.lockfree, which i cannot reproduce on my machine. the
algorithm in question (the spsc_queue) only makes use of atomic reads
and writes and only requires two memory barriers. the sandia machine is
a 4 cpu, 8 core/cpu machine, while my machines are all single-cpu

peter, the compare_exchange is in boost/atomic/detail/gcc-x86.hpp, the
code in question looks like:

        value_type & expected,
        value_type desired,
        memory_order success_order,
        memory_order failure_order) volatile
        value_type previous = expected;
        __asm__ (
            "lock ; cmpxchgl %2, %1"
            : "+a" (previous), "+m" (v_)
            : "r" (desired)
        bool success = (previous == expected);
        if (success)
        expected = previous;
        return success;

imo, the platform_fence_before/after is not necessary ...


Boost list run by bdawes at, gregod at, cpdaniel at, john at