MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / lock

Method lock

src/core/impl/utils/thread.cpp:16–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16void 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
31void RecursiveSpinlock::unlock() {
32 mgb_assert(

Callers 5

on_var_computedMethod · 0.45
load_cpuMethod · 0.45
do_allocMethod · 0.45
~ReceiverHandlerImplMethod · 0.45
worker_implMethod · 0.45

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected