X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=sched.c;h=ae6b2a9d3cb0ac6425d94482fc7892641fca5df8;hp=cad298b839b83a3f28e70912b1c85201ed589bd5;hb=6df282b25d3ca0f2a55dd09546d0efc42a437ace;hpb=80ff4e0205b6eefa603835fdc30f7f32fbd21f9f diff --git a/sched.c b/sched.c index cad298b8..ae6b2a9d 100644 --- a/sched.c +++ b/sched.c @@ -19,6 +19,8 @@ #include "error.h" struct task { + /** The task name supplied when the task was registered(). */ + char name[255]; /** Copied from the task_info struct during task_register(). */ void (*pre_select)(struct sched *s, struct task *t); /** Copied from the task_info struct during task_register(). */ @@ -27,8 +29,6 @@ struct task { int error; /** Position of the task in the task list of the scheduler. */ struct list_head node; - /** The task name supplied when the task was registered(). */ - char status[255]; /** If less than zero, the task was notified by another task. */ int notification; /** True if task is in error state and exit status has been queried. */ @@ -62,7 +62,7 @@ static void sched_preselect(struct sched *s) static void unlink_and_free_task(struct task *t) { - PARA_INFO_LOG("freeing task %s\n", t->status); + PARA_INFO_LOG("freeing task %s\n", t->name); list_del(&t->node); free(t); } @@ -83,7 +83,7 @@ static inline void call_post_select(struct sched *s, struct task *t) pst = tv2ms(&diff); if (pst > 50) PARA_WARNING_LOG("%s: post_select time: %lums\n", - t->status, pst); + t->name, pst); #endif } @@ -216,7 +216,7 @@ void sched_shutdown(struct sched *s) if (t->error >= 0) /* The task list should contain only terminated tasks. */ PARA_WARNING_LOG("shutting down running task %s\n", - t->status); + t->name); unlink_and_free_task(t); } } @@ -239,8 +239,8 @@ struct task *task_register(struct task_info *info, struct sched *s) if (!s->task_list.next) INIT_LIST_HEAD(&s->task_list); - snprintf(t->status, sizeof(t->status) - 1, "%s", info->name); - t->status[sizeof(t->status) - 1] = '\0'; + snprintf(t->name, sizeof(t->name) - 1, "%s", info->name); + t->name[sizeof(t->name) - 1] = '\0'; t->notification = 0; t->error = 0; t->dead = false; @@ -283,7 +283,7 @@ char *get_task_list(struct sched *s) char *tmp_msg; tmp_msg = make_message("%s%p\t%s\t%s\n", msg? msg : "", t, t->error < 0? (t->dead? "dead" : "zombie") : "running", - t->status); + t->name); free(msg); msg = tmp_msg; } @@ -314,7 +314,7 @@ void task_notify(struct task *t, int err) assert(err > 0); if (t->notification == -err) /* ignore subsequent notifications */ return; - PARA_INFO_LOG("notifying task %s: %s\n", t->status, para_strerror(err)); + PARA_INFO_LOG("notifying task %s: %s\n", t->name, para_strerror(err)); t->notification = -err; }