mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-13 06:29:47 -04:00
Fix wait_list::remove()
This commit is contained in:
parent
8c1fb92608
commit
2573dfb692
@ -38,7 +38,9 @@ struct wait_list {
|
||||
bool waiting() const;
|
||||
|
||||
/*!
|
||||
* \brief Removes the current process from the list
|
||||
* \brief Removes the current process from the list.
|
||||
*
|
||||
* The process must be in the list!
|
||||
*/
|
||||
void remove();
|
||||
|
||||
|
@ -38,8 +38,13 @@ void wait_list::remove(){
|
||||
auto pid = scheduler::get_pid();
|
||||
auto& process = scheduler::get_process(pid);
|
||||
|
||||
if(head == &process.wait){
|
||||
head = head->next;
|
||||
if (head == &process.wait) {
|
||||
if(head == tail){
|
||||
tail = head = nullptr;
|
||||
} else {
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -47,7 +52,12 @@ void wait_list::remove(){
|
||||
|
||||
while(node->next){
|
||||
if(node->next == &process.wait){
|
||||
if(tail == node->next){
|
||||
tail = node->next->next;
|
||||
}
|
||||
|
||||
node->next = node->next->next;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user