Quellcode durchsuchen

Handle overflow write with overflow in disruptor

main
Ludovic 'Archivist' Lagouardette vor 2 Jahren
Ursprung
Commit
65b5be2c88
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. +6
    -0
      LibSnugLog/include/disruptor.h

+ 6
- 0
LibSnugLog/include/disruptor.h Datei anzeigen

@ -119,6 +119,12 @@ public:
} else if constexpr (OverflowStrategy::on_overflow == overflow_response_t::must_overflow) {
if(!fence.compare_exchange_weak(fence_v, new_offset, std::memory_order_release, std::memory_order_relaxed)) {
return std::nullopt;
} else {
offset_t v;
do {
v = read_lead.load(std::memory_order_acquire);
if(v >= new_offset) break;
} while(read_lead.compare_exchange_weak(v, new_offset, std::memory_order_release, std::memory_order_relaxed));
}
} else {
static_assert(

Laden…
Abbrechen
Speichern