| 510 | } |
| 511 | |
| 512 | static bool __always_inline |
| 513 | lockmgr_slock_try(struct lock *lk, uintptr_t *xp, int flags, bool fp) |
| 514 | { |
| 515 | |
| 516 | /* |
| 517 | * If no other thread has an exclusive lock, or |
| 518 | * no exclusive waiter is present, bump the count of |
| 519 | * sharers. Since we have to preserve the state of |
| 520 | * waiters, if we fail to acquire the shared lock |
| 521 | * loop back and retry. |
| 522 | */ |
| 523 | while (LK_CAN_SHARE(*xp, flags, fp)) { |
| 524 | if (atomic_fcmpset_acq_ptr(&lk->lk_lock, xp, |
| 525 | *xp + LK_ONE_SHARER)) { |
| 526 | return (true); |
| 527 | } |
| 528 | } |
| 529 | return (false); |
| 530 | } |
| 531 | |
| 532 | static bool __always_inline |
| 533 | lockmgr_sunlock_try(struct lock *lk, uintptr_t *xp) |
no test coverage detected