#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(). */
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. */
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);
}
pst = tv2ms(&diff);
if (pst > 50)
PARA_WARNING_LOG("%s: post_select time: %lums\n",
- t->status, pst);
+ t->name, pst);
#endif
}
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);
}
}
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;
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;
}
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;
}