pub fn pop_ready_thread(&mut self) -> Option<uint> {
		// no shelved thread can run if the monitor is locked
		if self.is_locked() {
			return None;
		}

		// check if there is any wait()ing thread that has been
		// notify()ed and is therefore ready to run again.
		if self.waiters_prio.len() > 0 {
			let (notified, tid, lock_count) = self.waiters_prio[0];
			if notified {
				self.waiters_prio.shift();
				return Some(tid);
			}
		}

		// otherwise just pick any thread who is waiting to
		// lock the mutex.
		self.waiters.shift()
	}
// ----------------------------------------------
// Check if there is a thread waiting to lock the monitor
// that is ready to do so (i.e. it has been notified or
// it comes from outside) and return it.
Check if there is a thread waiting to lock the monitor
that is ready to do so  and return it.
Check if there is a thread waiting to lock the monitor that is ready to do so and return it .
pub fn pop_ready_thread(&mut self) -> Option<uint> {
		// no shelved thread can run if the monitor is locked
		if self.is_locked() {
			return None;
		}
		// check if there is any wait()ing thread that has been
		// notify()ed and is therefore ready to run again.
		if self.waiters_prio.len() > 0 {
			let (notified, tid, lock_count) = self.waiters_prio[0];
			if notified {
				self.waiters_prio.shift();
				return Some(tid);
			}
		}
		// otherwise just pick any thread who is waiting to
		// lock the mutex.
		self.waiters.shift()
	}
pub fn pop_ready_thread ( & mut self ) -> Option < uint > { // no shelved thread can run if the monitor is locked if self . is_locked ( ) { return None ; } // check if there is any wait()ing thread that has been // notify()ed and is therefore ready to run again. if self . waiters_prio . len ( ) > 0 { let ( notified , tid , lock_count ) = self . waiters_prio [ 0 ] ; if notified { self . waiters_prio . shift ( ) ; return Some ( tid ) ; } } // otherwise just pick any thread who is waiting to // lock the mutex. self . waiters . shift ( ) }
Check if there is a thread waiting to lock the monitor
that is ready to do so (i.e.
Check if there is a thread waiting to lock the monitor that is ready to do so ( i . e .
&mut self