aboutsummaryrefslogtreecommitdiff
path: root/src/uapi/proc.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-03 17:41:28 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-03 17:47:58 +0300
commit66e7f184a925247bac51aae02d01483faa5454fc (patch)
tree8e4b3d0ce59305ccf5f93fd8f5b75be528a58633 /src/uapi/proc.c
parente06772a964e269d2d9abcb43a1edd868a62d4610 (diff)
downloadkmi-66e7f184a925247bac51aae02d01483faa5454fc.tar.gz
kmi-66e7f184a925247bac51aae02d01483faa5454fc.zip
simplify notifications a little
Diffstat (limited to 'src/uapi/proc.c')
-rw-r--r--src/uapi/proc.c15
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));
}