Skip to content

Commit

Permalink
bugfix: Fix a couple of bugs in the no_std implementation
Browse files Browse the repository at this point in the history
- Prevent a panic for when the task has already been taken in the node
- Fix a null pointer dereference in the backup queue

Signed-off-by: John Nunley <[email protected]>
  • Loading branch information
notgull authored Aug 17, 2023
1 parent 7ce2634 commit 1c95cd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/no_std/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ impl TaskWaiting {
// If the entry ID is non-zero, then we are no longer queued.
if self.status().is_some() {
// Wake the task.
self.task.take().unwrap().wake();
if let Some(task) = self.task.take() {
task.wake();
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/no_std/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl<T> Queue<T> {

// The head was set by another thread, so we need to try again.
tail = self.tail.load(Ordering::Acquire);
continue;
}

unsafe {
Expand Down

0 comments on commit 1c95cd2

Please sign in to comment.