| 14 | } |
| 15 | |
| 16 | void RecursiveSpinlock::lock() { |
| 17 | auto tid = std::this_thread::get_id(); |
| 18 | if (m_owner.load(std::memory_order_relaxed) != tid) { |
| 19 | for (;;) { |
| 20 | auto id = sm_none_owner; |
| 21 | if (m_owner.compare_exchange_weak( |
| 22 | id, tid, std::memory_order_acquire, |
| 23 | std::memory_order_relaxed)) { |
| 24 | break; |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | ++m_recur_count; |
| 29 | } |
| 30 | |
| 31 | void RecursiveSpinlock::unlock() { |
| 32 | mgb_assert( |
no test coverage detected