Changes
→Implementation
==Condition.java==
===Implementation===
Condition2 has a new state variable {{c|waitQueue}}, a {{c|ThreadQueue }} with {{c|transferPriority }} flag set to false. * In the {{c|sleep() }} method, we disable interrupts, the current thread is added to the {{c|waitQueue }} of threads, the corresponding lock is released, and the current thread is put to sleep. When it wakes up, the thread attempts to reacquire the condition lock and interrupts are re-enabled. * The {{c|wake() }} method disables interrupts and retrieves the next thread from the {{c|waitQueue}}. If the thread returned is not null, that thread calls ready()is readied. Finally, wake() the interrupts are re-enables the interruptsenabled.* The {{c|wakeAll() }} method also disables the interrupts and stored the next thread from the {{c|waitQueue }} as a {{c|KThread}} variable {{c|nextThread}}. While {{c|nextThread }} is not null, the method will ready that thread and reset {{c|nextThread }} as the next thread from the {{c|waitQueue}}. This procedure continues until there are no more threads in {{c|waitQueue}}.
===Testing===