mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
semaphore: signal safety
This commit is contained in:
@@ -417,14 +417,14 @@ void sched_preparesleep(bool interruptible) {
|
||||
_cpu()->thread->flags |= SCHED_THREAD_FLAGS_SLEEP | (interruptible ? SCHED_THREAD_FLAGS_INTERRUPTIBLE : 0);
|
||||
}
|
||||
|
||||
void sched_wakeup(thread_t *thread, int reason) {
|
||||
bool 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 == SCHED_WAKEUP_REASON_INTERRUPTED) && (thread->flags & SCHED_THREAD_FLAGS_INTERRUPTIBLE) == 0)) {
|
||||
spinlock_release(&thread->sleeplock);
|
||||
interrupt_set(intstate);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
thread->flags &= ~(SCHED_THREAD_FLAGS_SLEEP | SCHED_THREAD_FLAGS_INTERRUPTIBLE);
|
||||
@@ -433,6 +433,8 @@ void sched_wakeup(thread_t *thread, int reason) {
|
||||
spinlock_release(&thread->sleeplock);
|
||||
sched_queue(thread);
|
||||
interrupt_set(intstate);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static vnode_t *getnodeslock(vnode_t **addr) {
|
||||
|
||||
Reference in New Issue
Block a user