Mercurial > sci
view sciworkerd/task.h @ 18:600204c31bf0
misc: refactor
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 12 Jul 2022 20:20:51 +0200 |
parents | |
children | de4bf839b565 |
line wrap: on
line source
#ifndef SCIWORKERD_TASK_H #define SCIWORKERD_TASK_H #include <sys/types.h> struct job; struct pollfd; struct task; enum taskstatus { TASKSTATUS_PENDING, /* not started yet. */ TASKSTATUS_RUNNING, /* currently running. */ TASKSTATUS_EXITED, /* process exited normally. */ TASKSTATUS_KILLED, /* process killed killed. */ TASKSTATUS_SYNCING /* was unable to send result to host. */ }; struct taskcode { int exitcode; int sigcode; }; struct task * task_new(const struct job *job); int task_setup(struct task *self, const char *script); pid_t task_start(struct task *self); int task_wait(struct task *self); int task_kill(struct task *self); void task_prepare(struct task *self, struct pollfd *fd); int task_sync(struct task *self, const struct pollfd *fd); time_t task_uptime(const struct task *self); const char * task_console(const struct task *self); enum taskstatus task_status(const struct task *self); struct taskcode task_code(const struct task *self); void task_free(struct task *self); #endif /* !SCIWORKERD_TASK_H */