Changes

Jump to: navigation, search

Computer Science/162/proj1

6 bytes added, 23:21, 4 October 2008
Implementation
==Condition.java==
===Implementation===
Condition2 has a new state variable {{c|waitQueue}}, a ThreadQueue with transferPriority flag set to false.
* In the sleep() method, we disable interrupts, the current thread is added to the 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 wake() method disables interrupts and retrieves the next thread from the waitQueue. If the thread returned is not null, that thread calls ready(). Finally, wake() re-enables the interrupts.
Anonymous user

Navigation menu