Lock:
int ObjectMonitor: : TryLock (Self) Thread * {
For (;; ) {
Void * own=_owner;
If (own!=NULL) return 0;//if there is a thread owns a heavyweight lock, exit
//amend the _owner CAS operation for the current thread, operation success return> 0
If (Atomic: : cmpxchg_ptr (Self, & amp; _owner, NULL)==NULL) {
Return 1;
}
//CAS return< update failure; 0
If (true) return 1;
}
}
No competition to lock the thread will hang, this part do have kernel mode switch, but definitely not used to the mutex lock
Don't know if I understand right for help you a great god