]> git.corax.cc Git - corax/commitdiff
Suspend the executing task, if the caller of sched_task_suspend() is attempting to...
authorMatthias Kruk <m@m10k.eu>
Mon, 25 Nov 2019 06:22:45 +0000 (15:22 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 25 Nov 2019 06:22:45 +0000 (15:22 +0900)
kernel/core/sched.c

index 00f458fbd1145becd194fb987852ca43327be511..15a8a0f18668c4bcc311c2e66d36a365a6418e0f 100644 (file)
@@ -225,12 +225,14 @@ int sched_signal(pid_t pid)
 
 int sched_task_suspend(task_t *t)
 {
+       task_t *ctask;
        int ret_val;
 
        ret_val = -EALREADY;
+    ctask = task_get_current();
 
        if(!t) {
-               t = task_get_current();
+               t = ctask;
        }
 
        task_lock(t);
@@ -248,5 +250,10 @@ int sched_task_suspend(task_t *t)
 
        task_unlock(t);
 
+       if(t == ctask) {
+               /* schedule a different task */
+               sched_tick();
+       }
+
        return(ret_val);
 }