| 89 | } |
| 90 | |
| 91 | bool MutexRP::try_lock() { |
| 92 | if (mSpinlock == nullptr) { |
| 93 | return false; |
| 94 | } |
| 95 | |
| 96 | spin_lock_t* spinlock = static_cast<spin_lock_t*>(mSpinlock); |
| 97 | |
| 98 | // Try to acquire the spinlock without blocking |
| 99 | // Use spin_try_lock_unsafe which returns true if lock acquired |
| 100 | bool acquired = spin_try_lock_unsafe(spinlock); |
| 101 | |
| 102 | if (acquired) { |
| 103 | mLocked = true; |
| 104 | mOwnerCore = get_core_num(); |
| 105 | } |
| 106 | |
| 107 | return acquired; |
| 108 | } |
| 109 | |
| 110 | //============================================================================= |
| 111 | // RecursiveMutexRP Implementation |
no outgoing calls
no test coverage detected