aboutsummaryrefslogtreecommitdiff
path: root/src/uapi/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uapi/proc.c')
-rw-r--r--src/uapi/proc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/uapi/proc.c b/src/uapi/proc.c
index 153b183..e87a2ec 100644
--- a/src/uapi/proc.c
+++ b/src/uapi/proc.c
@@ -10,6 +10,7 @@
#include <kmi/uapi.h>
#include <kmi/proc.h>
#include <kmi/bits.h>
+#include <kmi/notify.h>
#include <kmi/mem_regions.h>
/**
@@ -186,6 +187,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;
+
+ /* handle possible queued notification */
+ if (s->notify_state == NOTIFY_QUEUED)
+ notify(s, 0);
+
/* get register state for new thread */
return_args(s, get_args(s));
}