Skip to content

Commit

Permalink
hjert-core: Added a small fast path in Task::block().
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Jan 2, 2025
1 parent 91c82c8 commit 2c497f7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kernel/hjert-core/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Res<> Task::ready(usize ip, usize sp, Hj::Args args) {
}

Res<> Task::block(Blocker blocker) {
// NOTE: If the blocker is already expired, don't block.
if (blocker() <= globalSched()._stamp)
return Ok();

// NOTE: Can't use ObjectLockScope here because
// we need to yield outside of the lock.
_lock.acquire();
Expand Down

0 comments on commit 2c497f7

Please sign in to comment.