Skip to content

Commit 1c95cd2

Browse files
authored
bugfix: Fix a couple of bugs in the no_std implementation
- 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]>
1 parent 7ce2634 commit 1c95cd2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/no_std/node.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ impl TaskWaiting {
127127
// If the entry ID is non-zero, then we are no longer queued.
128128
if self.status().is_some() {
129129
// Wake the task.
130-
self.task.take().unwrap().wake();
130+
if let Some(task) = self.task.take() {
131+
task.wake();
132+
}
131133
}
132134
}
133135
}

src/no_std/queue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl<T> Queue<T> {
5858

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

6364
unsafe {

0 commit comments

Comments
 (0)