From 66e7f184a925247bac51aae02d01483faa5454fc Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 3 Jul 2024 17:41:28 +0300 Subject: simplify notifications a little --- src/uapi/proc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/uapi/proc.c') diff --git a/src/uapi/proc.c b/src/uapi/proc.c index bb4b463..1b672ce 100644 --- a/src/uapi/proc.c +++ b/src/uapi/proc.c @@ -13,6 +13,8 @@ #include #include +#include + /** * Create syscall handler. * @@ -190,17 +192,14 @@ SYSCALL_DEFINE1(swap)(struct tcb *t, sys_arg_t tid){ /* set return value for current thread */ set_args1(t, OK); - /* not running anymore lol */ - if (t->notify_state == NOTIFY_RUNNING) - t->notify_state = NOTIFY_WAITING; + /* if an irq handler is directly swapping to some other thread, + * interpret it as the thread being finished with its critical section */ + enable_irqs(); /* handle possible queued notification */ - if (s->notify_state == NOTIFY_QUEUED) + if (s->notify_flags) notify(s, 0); - /* if an irq handler is directly swapping to some other thread, - * interpret it as the thread being finished with its critical section */ - enable_irqs(); - /* get register state for new thread */ + /* no notifications, so get register state for new thread */ return_args(s, get_args(s)); } -- cgit v1.3