mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
scheduler: better define wakeup reasons
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
#define SCHED_PROC_STATE_NORMAL 0
|
||||
#define SCHED_PROC_STATE_ZOMBIE 1
|
||||
|
||||
#define SCHED_WAKEUP_REASON_NORMAL 0
|
||||
#define SCHED_WAKEUP_REASON_INTERRUPTED -1
|
||||
|
||||
#define STACK_TOP (void *)0x0000800000000000
|
||||
#define INTERP_BASE (void *)0x00000beef0000000
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ void keyboard_sendpacket(keyboard_t *kb, kbpacket_t *packet) {
|
||||
|
||||
int keyboard_wait(keyboard_t *kb, kbpacket_t *packet) {
|
||||
int e = semaphore_wait(&kb->semaphore, true);
|
||||
if (e == EINTR)
|
||||
if (e == SCHED_WAKEUP_REASON_INTERRUPTED)
|
||||
return e;
|
||||
long ipl = interrupt_raiseipl(IPL_KEYBOARD);
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ void sched_wakeup(thread_t *thread, int reason) {
|
||||
bool intstate = interrupt_set(false);
|
||||
spinlock_acquire(&thread->sleeplock);
|
||||
|
||||
if ((thread->flags & SCHED_THREAD_FLAGS_SLEEP) == 0 || (reason == EINTR && (thread->flags & SCHED_THREAD_FLAGS_INTERRUPTIBLE) == 0)) {
|
||||
if ((thread->flags & SCHED_THREAD_FLAGS_SLEEP) == 0 || ((reason == SCHED_WAKEUP_REASON_INTERRUPTED) && (thread->flags & SCHED_THREAD_FLAGS_INTERRUPTIBLE) == 0)) {
|
||||
spinlock_release(&thread->sleeplock);
|
||||
interrupt_set(intstate);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user