Disruptor-cpp icon indicating copy to clipboard operation
Disruptor-cpp copied to clipboard

MultProducerSequencer.setAvailable(): difference to java version

Open bogdad opened this issue 1 year ago • 0 comments

Hey,

thank you for the port! I was comparing to java version, and feels MultProducerSequencer.setAvailable() has different visibility properties?

void setAvailableBufferValue(std::int32_t index, std::int32_t flag)
{
    m_availableBuffer[index] = flag;
}

vs https://github.com/LMAX-Exchange/disruptor/blob/95c705f60c1833b07f1fed6e08a08d7bee7f0971/src/main/java/com/lmax/disruptor/MultiProducerSequencer.java#L235

    private void setAvailableBufferValue(final int index, final int flag)
    {
        AVAILABLE_ARRAY.setRelease(availableBuffer, index, flag);
    }

setRelease (the docs say) is roughly equivalent to m_atomic_int.store(..., std::memory_order_release);

the cpp version does not have the release memory semantics? I cant see why its not needed in c++ version, do you know?

bogdad avatar Jul 08 '24 20:07 bogdad