public void release() {
        Lib.assertTrue(isHeldByCurrentThread());

        boolean intStatus = Machine.interrupt().disable();
        KThread thread = lockHolder;
        if(useSPS)
            temp.printReleaseLock(lockHolder, this);
        
        if(useDonation){
            updateHighestPriority();
        }
        if ((lockHolder = waitQueue.nextThread()) != null){
            if(useSPS)
                temp.printAquireLock(lockHolder, this);
            lockHolder.ready();
        }
        
        if(useSPS)
            temp.removeLock(thread, this);
        Machine.interrupt().restore(intStatus);
    }