Fix the sleep queue even more

This commit is contained in:
Baptiste Wicht 2016-08-18 22:00:56 +02:00
parent 531d0137fd
commit c663cfc21c

View File

@ -135,16 +135,18 @@ public:
// If the queue still contains our pid, it means a wake up // If the queue still contains our pid, it means a wake up
// from timeout // from timeout
// If the pid is on top, pop it if(!queue.empty()){
if(queue.top() == pid){ // If the pid is on top, pop it
obtained = false; if(queue.top() == pid){
queue.pop(); obtained = false;
} queue.pop();
// If the pid is inside the queue, replace it with an invalid pid }
// If this happens too often, we'll need a better pid queue // If the pid is inside the queue, replace it with an invalid pid
else if(queue.contains(pid)){ // If this happens too often, we'll need a better pid queue
obtained = false; else if(queue.contains(pid)){
queue.replace(pid, scheduler::INVALID_PID); obtained = false;
queue.replace(pid, scheduler::INVALID_PID);
}
} }
// Final release of the lock // Final release of the lock