Files
miniboinc/include/common/task/task.h
2026-01-15 09:05:19 +01:00

48 lines
772 B
C

#ifndef TASK_H
#define TASK_H
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <common/dynarr.h>
typedef enum {
TASK_NONE,
TASK_PENDING,
TASK_ASSIGNED,
TASK_DONE,
TASK_FAILED
} task_state_t;
extern int TASK_ERR_CODE;
typedef enum {
TASK_ERR_NONE,
TASK_ERR_INVPTR,
TASK_ERR_INVARGS,
TASK_ERR_INVQUEUE,
TASK_ERR_INVIDX,
TASK_ERR_INVTASK
} task_err;
typedef struct {
char name[32]; // string
DynArr* data;
} task_arg_t;
typedef struct {
uint32_t taskId;
char binary[64];
DynArr* args;
task_state_t state;
uint32_t assigned_to;
time_t assigned_at;
DynArr* results;
} task_t;
void Task_Create(task_t* tsk);
void Task_DestroyArgs(task_t* task);
#endif