diff options
Diffstat (limited to 'src/uapi/proc.c')
| -rw-r--r-- | src/uapi/proc.c | 15 |
1 files changed, 7 insertions, 8 deletions
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 <kmi/notify.h> #include <kmi/mem_regions.h> +#include <arch/irq.h> + /** * 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)); } |
