poll: rework timeout

This commit is contained in:
Matheus
2025-11-02 21:32:04 -03:00
parent c9d401f488
commit 3b6b5363ad
5 changed files with 36 additions and 23 deletions
+2 -4
View File
@@ -79,7 +79,7 @@ static void timeout(context_t *, dpcarg_t arg) {
spinlock_acquire(&desc->eventlock);
if (spinlock_try(&desc->lock))
sched_wakeup(desc->thread, 1);
sched_wakeup(desc->thread, ETIMEDOUT);
spinlock_release(&desc->eventlock);
interrupt_set(intstate);
@@ -115,15 +115,13 @@ int poll_dowait(polldesc_t *desc, size_t ustimeout) {
ret = EINTR;
}
if (ustimeout != 0 && ret != 1) {
if (ustimeout != 0 && ret != ETIMEDOUT) {
timer_remove(current_cpu()->timer, &sleepentry);
sched_target_cpu(NULL);
}
interrupt_set(intstate);
ret = ret == 1 ? 0 : ret;
return ret;
}