Skip to content

Commit

Permalink
xous: thread_parking: fix logic on wakeup race
Browse files Browse the repository at this point in the history
When waking up a thread and there's a race condition, the logic may be
inverted. Or the thread may time out, in which case there is no thread
to wake up.

Signed-off-by: Sean Cross <[email protected]>
  • Loading branch information
xobs committed Dec 24, 2023
1 parent 722c218 commit feb0bdd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/sys/xous/thread_parking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ impl Parker {
TicktimerScalar::NotifyCondition(self.index(), 1).into(),
)
.expect("failed to send NotifyCondition command")[0]
== 1
!= 1
&& self.state.load(Acquire) != EMPTY
{
// The target thread hasn't yet hit the `WaitForCondition` call.
// Yield to let the target thread run some more.
Expand Down

0 comments on commit feb0bdd

Please sign in to comment.