5 MIN_INT(
std::numeric_limits<int>::
min())
13 if(!m_refCounter.compare_exchange_strong(expected, MIN_INT,
14 std::memory_order_acquire,
15 std::memory_order_relaxed)){
18 std::unique_lock<std::mutex> lk(m_waitMutex);
19 m_waitConditional.wait(lk, [
this,&expected] {
20 if(!m_refCounter.compare_exchange_strong(expected, MIN_INT,
21 std::memory_order_acquire,
22 std::memory_order_relaxed)){
35 return m_refCounter.compare_exchange_strong(expected, MIN_INT,
36 std::memory_order_acquire,
37 std::memory_order_relaxed);
42 m_refCounter.store(0, std::memory_order_release);
43 m_waitConditional.notify_all();
48 if(m_refCounter.fetch_add(1, std::memory_order_acquire) < 0){
49 m_refCounter.fetch_sub(1, std::memory_order_release);
51 std::unique_lock<std::mutex> lk(m_waitMutex);
52 m_waitConditional.wait(lk, [
this]{
53 return m_refCounter.fetch_add(1, std::memory_order_acquire) >= 0;
61 return m_refCounter.fetch_add(1, std::memory_order_acquire) >= 0;
66 m_refCounter.fetch_sub(1, std::memory_order_release);
67 m_waitConditional.notify_one();