mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-14 15:06:52 -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;
|
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();
|
void remove();
|
||||||
|
|
||||||
|
@ -38,8 +38,13 @@ void wait_list::remove(){
|
|||||||
auto pid = scheduler::get_pid();
|
auto pid = scheduler::get_pid();
|
||||||
auto& process = scheduler::get_process(pid);
|
auto& process = scheduler::get_process(pid);
|
||||||
|
|
||||||
if(head == &process.wait){
|
if (head == &process.wait) {
|
||||||
head = head->next;
|
if(head == tail){
|
||||||
|
tail = head = nullptr;
|
||||||
|
} else {
|
||||||
|
head = head->next;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +52,12 @@ void wait_list::remove(){
|
|||||||
|
|
||||||
while(node->next){
|
while(node->next){
|
||||||
if(node->next == &process.wait){
|
if(node->next == &process.wait){
|
||||||
|
if(tail == node->next){
|
||||||
|
tail = node->next->next;
|
||||||
|
}
|
||||||
|
|
||||||
node->next = node->next->next;
|
node->next = node->next->next;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user