| 823 | _thread_lock(struct thread *td, int opts, const char *file, int line) |
| 824 | #else |
| 825 | void |
| 826 | _thread_lock(struct thread *td) |
| 827 | #endif |
| 828 | { |
| 829 | struct mtx *m; |
| 830 | uintptr_t tid; |
| 831 | |
| 832 | tid = (uintptr_t)curthread; |
| 833 | |
| 834 | if (__predict_false(LOCKSTAT_PROFILE_ENABLED(spin__acquire))) |
| 835 | goto slowpath_noirq; |
| 836 | spinlock_enter(); |
| 837 | m = td->td_lock; |
| 838 | thread_lock_validate(m, 0, file, line); |
| 839 | if (__predict_false(m == &blocked_lock)) |
| 840 | goto slowpath_unlocked; |
| 841 | if (__predict_false(!_mtx_obtain_lock(m, tid))) |
| 842 | goto slowpath_unlocked; |
| 843 | if (__predict_true(m == td->td_lock)) { |
| 844 | WITNESS_LOCK(&m->lock_object, LOP_EXCLUSIVE, file, line); |
| 845 | return; |
| 846 | } |
| 847 | _mtx_release_lock_quick(m); |
| 848 | slowpath_unlocked: |
| 849 | spinlock_exit(); |
| 850 | slowpath_noirq: |
| 851 | #if LOCK_DEBUG > 0 |
| 852 | thread_lock_flags_(td, opts, file, line); |
| 853 | #else |
| 854 | thread_lock_flags_(td, 0, 0, 0); |
| 855 | #endif |
| 856 | } |
| 857 | #endif |
| 858 | |
| 859 | void |
nothing calls this directly
no test coverage detected