if (q == &lock->waitQ) {  lock->boostPriority = PR_PRIORITY_LOW; lock->owner = 0; } else { if (_PR_AssignLock(lock) == NULL) {  lock->boostPriority = PR_PRIORITY_LOW; lock->owner = 0; } }
if (q != &lock->waitQ) _PR_UnblockWaiters(lock); lock->boostPriority = PR_PRIORITY_LOW; lock->owner = 0;
PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock *lock){    PRCList *q;    PRThreadPriority pri, boost;    PRIntn is;    PRThread *me = _PR_MD_CURRENT_THREAD();    PR_ASSERT(lock->owner == me);    PR_ASSERT(me != suspendAllThread); #if !defined(XP_MAC)    PR_ASSERT(!(me->flags & _PR_IDLE_THREAD));#endif    if (lock->owner != me) {        return PR_FAILURE;    }#ifdef _PR_GLOBAL_THREADS_ONLY     lock->owner = 0;    _PR_MD_UNLOCK(&lock->ilock);    return PR_SUCCESS;#else  /* _PR_GLOBAL_THREADS_ONLY */	if (_native_threads_only) {		lock->owner = 0;		_PR_MD_UNLOCK(&lock->ilock);		return PR_SUCCESS;	}    if (!_PR_IS_NATIVE_THREAD(me))    	_PR_INTSOFF(is);    _PR_LOCK_LOCK(lock);	/* Remove the lock from the owning thread's lock list */    PR_REMOVE_LINK(&lock->links);    pri = lock->priority;    boost = lock->boostPriority;    if (boost > pri) {        /*        ** We received a priority boost during the time we held the lock.        ** We need to figure out what priority to move to by scanning        ** down our list of lock's that we are still holding and using        ** the highest boosted priority found.        */        q = me->lockList.next;        while (q != &me->lockList) {            PRLock *ll = _PR_LOCK_PTR(q);            if (ll->boostPriority > pri) {                pri = ll->boostPriority;            }            q = q->next;        }        if (pri != me->priority) {            _PR_SetThreadPriority(me, pri);        }    }    /* Assign the lock to the first waiting thread */    q = lock->waitQ.next;    if (q == &lock->waitQ) {        /* Nobody wants the lock right now */        lock->boostPriority = PR_PRIORITY_LOW;        lock->owner = 0;    } else {      if (_PR_AssignLock(lock) == NULL) {	/* no eligible thread to assign to */        lock->boostPriority = PR_PRIORITY_LOW;        lock->owner = 0;      }    }    _PR_LOCK_UNLOCK(lock);    if (!_PR_IS_NATIVE_THREAD(me))    	_PR_INTSON(is);    return PR_SUCCESS;#endif  /* _PR_GLOBAL_THREADS_ONLY */}