MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / try_lock

Method try_lock

thread/thread.cpp:1730–1736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1728 return waitq_translate_errno(ret);
1729 }
1730 int mutex::try_lock()
1731 {
1732 thread* ptr = nullptr;
1733 bool ret = owner.compare_exchange_strong(ptr, CURRENT,
1734 std::memory_order_acq_rel, std::memory_order_relaxed);
1735 return (int)ret - 1;
1736 }
1737 inline void do_mutex_unlock(mutex* m)
1738 {
1739 SCOPED_LOCK(m->splock);

Callers 7

wait_completionMethod · 0.45
borrowMethod · 0.45
st_mutex_trylockFunction · 0.45
env_mutex_trylockFunction · 0.45
env_spinlock_trylockFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected