]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
sched: Remove ->owned_by_sched.
authorAndre Noll <maan@systemlinux.org>
Sat, 1 Mar 2014 11:55:38 +0000 (12:55 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 May 2014 13:39:00 +0000 (15:39 +0200)
With register_task() gone, the ->owned_by_sched field of struct sched
is always true (it gets set in task_register()). So we can remove it.

sched.c
sched.h

diff --git a/sched.c b/sched.c
index fe57e03eae01a1d4360ae41cdf61f893a9888128..1b83b704fb48599d7c44ba540bc90b90e040be9b 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -45,8 +45,7 @@ static void unlink_and_free_task(struct task *t)
 {
        PARA_INFO_LOG("freeing task %s\n", t->status);
        list_del(&t->node);
-       if (t->owned_by_sched)
-               free(t);
+       free(t);
 }
 
 //#define SCHED_DEBUG 1
@@ -82,10 +81,7 @@ static unsigned sched_post_select(struct sched *s)
                }
                call_post_select(s, t);
                t->notification = 0;
-               if (t->error < 0) {
-                       if (!t->owned_by_sched)
-                               list_del(&t->node);
-               } else
+               if (t->error >= 0)
                        num_running_tasks++;
        }
        return num_running_tasks;
@@ -169,8 +165,6 @@ int task_reap(struct task **tptr)
        t = *tptr;
        if (!t)
                return 0;
-       if (!t->owned_by_sched)
-               return 0;
        if (t->error >= 0)
                return 0;
        if (t->dead) /* will be freed in sched_post_select() */
@@ -234,7 +228,6 @@ struct task *task_register(struct task_info *info, struct sched *s)
        t->pre_select = info->pre_select;
        t->post_select = info->post_select;
        t->context = info->context;
-       t->owned_by_sched = true;
        list_add_tail(&t->node, &s->task_list);
        return t;
 }
@@ -249,7 +242,6 @@ struct task *task_register(struct task_info *info, struct sched *s)
  */
 void *task_context(struct task *t)
 {
-       assert(t->owned_by_sched);
        return t->context;
 }
 
diff --git a/sched.h b/sched.h
index 0b7df7e8fd72f9d90f531bcec37ddb4922f72fb7..db6ee7dc3a21a6a87037a3bad331d4ae081e271a 100644 (file)
--- a/sched.h
+++ b/sched.h
@@ -53,8 +53,6 @@ struct task {
        char status[255];
        /** If less than zero, the task was notified by another task. */
        int notification;
-       /** Whether the task structure should be freed in sched_shutdown(). */
-       bool owned_by_sched;
        /** True if task is in error state and exit status has been queried. */
        bool dead;
        /** Usually a pointer to the struct containing this task. */