| 29 | } |
| 30 | |
| 31 | void RecursiveSpinlock::unlock() { |
| 32 | mgb_assert( |
| 33 | m_recur_count && |
| 34 | m_owner.load(std::memory_order_relaxed) == std::this_thread::get_id()); |
| 35 | if (!(--m_recur_count)) { |
| 36 | m_owner.store(sm_none_owner, std::memory_order_release); |
| 37 | } |
| 38 | } |
| 39 | #else |
| 40 | #if MGB_HAVE_THREAD |
| 41 | #error "can not disable thread safety while enabling thread support" |