Sfoglia il codice sorgente

优化event

tags/v2.9.7
tearshark 4 anni fa
parent
commit
ece8c19952
1 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 6
    3
      librf/src/event_v2.inl

+ 6
- 3
librf/src/event_v2.inl Vedi File

@@ -35,9 +35,12 @@ RESUMEF_NS
bool try_wait_one() noexcept
{
if (_counter.fetch_add(-1, std::memory_order_acq_rel) > 0)
return true;
_counter.fetch_add(1);
if (_counter.load(std::memory_order_acquire) > 0)
{
if (_counter.fetch_add(-1, std::memory_order_acq_rel) > 0)
return true;
_counter.fetch_add(1);
}
return false;
}

Loading…
Annulla
Salva