a thread on e select and remove one thread from e and restart it (this thread will occupy the monitor next) else unlock the monitor (the monitor will become unoccupied) The schedule routine selects the next thread to occupy the monitor or, in the absence of any candidate threads, unlocks the monitor. The resulting signaling discipline is known as "signal and urgent wait," as the signaler must wait, but is given priority over threads on the entrance queue. An alternative is "signal and wait," in which there is no s queue and signaler waits on the e queue instead. Some implementations provide a signal and return operation that combines signaling with returning from a procedure. signal and return: if there is a thread waiting on .q select and remove one such thread t from .q (t is called "the signaled thread") restart t (so t will occupy the monitor next) else schedule return from the method In either case ("signal and urgent wait" or "signal and wait"), when a condition variable is signaled and there is at least one thread waiting on the condition variable, the signaling thread hands occupancy over to the signaled thread seamlessly, so that no other thread can gain occupancy in between. If is true at the start of each signal operation, it will be true at the end of each wait operation. This is summarized by the following contracts. In these contracts, is the monitor's invariant. enter the monitor: postcondition leave the monitor: precondition wait : precondition modifies the state of the monitor postcondition and signal : precondition and modifies the state of the monitor postcondition signal and return: precondition and In these contracts, it is assumed that and do not depend on the contents or lengths of any queues. (When the condition variable can be queried as to the number of threads waiting on its queue, more sophisticated contracts can be given. For example, a useful pair of contracts, allowing occupancy to be passed without establishing the invariant, is: wait : precondition modifies the state of the monitor postcondition signal precondition (not empty() and ) or (empty() and ) modifies the state of the monitor postcondition (See Howard and Buhr et al. for more.) It is important to note here that the assertion is entirely up to the programmer; he or she simply needs to be consistent about what it is. We conclude this