14 #define CRINIT_MONITOR_DEP_NAME "@crinitmon"
15 #define CRINIT_PROVIDE_DEP_NAME "@provided"
16 #define CRINIT_TASKDB_INITIAL_SIZE 256
43 #define crinitTaskDbForEach(taskDb, task) \
44 for ((task) = (taskDb)->taskSet; (task) != (taskDb)->taskSet + (taskDb)->taskSetItems; (task)++)
67 #define crinitTaskDBUpdate(ctx, t) crinitTaskDBInsert(ctx, t, true)
267 #define crinitTaskDBInit(ctx, spawnFunc) crinitTaskDBInitWithSize(ctx, spawnFunc, CRINIT_TASKDB_INITIAL_SIZE);
unsigned long crinitTaskState_t
Type to store Task state bitmask.
Definition: crinit-sdefs.h:17
int(* spawnFunc)(struct crinitTaskDB_t *ctx, const crinitTask_t *)
Definition: taskdb.h:27
bool spawnInhibit
Specifies if process spawning is currently inhibited, respected by crinitTaskDBSpawnReady().
Definition: taskdb.h:30
size_t taskSetSize
Current maximum size of the task array.
Definition: taskdb.h:23
pthread_cond_t changed
Condition variable to be signalled if taskSet or spawnInhibit is changed.
Definition: taskdb.h:34
pthread_mutex_t lock
Definition: taskdb.h:32
size_t taskSetItems
Number of elements in the task array.
Definition: taskdb.h:24
crinitTask_t * taskSet
Dynamic array of tasks, corresponds to task configs specified in the series config.
Definition: taskdb.h:22
Header defining the data structures belonging to a single task and related functions.
int crinitTaskDBInsert(crinitTaskDB_t *ctx, const crinitTask_t *t, bool overwrite)
Definition: taskdb.c:96
int crinitTaskDBDestroy(crinitTaskDB_t *ctx)
Definition: taskdb.c:76
struct crinitTaskDB_t crinitTaskDB_t
int crinitTaskDBInitWithSize(crinitTaskDB_t *ctx, int(*spawnFunc)(crinitTaskDB_t *ctx, const crinitTask_t *), size_t initialSize)
Definition: taskdb.c:38
int crinitTaskDBGetTaskState(crinitTaskDB_t *ctx, crinitTaskState_t *s, const char *taskName)
Definition: taskdb.c:231
int crinitTaskDBExportTaskNamesToArray(crinitTaskDB_t *ctx, char **tasks[], size_t *numTasks)
Definition: taskdb.c:460
int crinitTaskDBSetTaskPID(crinitTaskDB_t *ctx, pid_t pid, const char *taskName)
Definition: taskdb.c:251
int crinitTaskDBAddDepToTask(crinitTaskDB_t *ctx, const crinitTaskDep_t *dep, const char *taskName)
Definition: taskdb.c:312
int crinitTaskDBGetTaskPID(crinitTaskDB_t *ctx, pid_t *pid, const char *taskName)
Definition: taskdb.c:270
int crinitTaskDBProvideFeature(crinitTaskDB_t *ctx, const crinitTask_t *provider, crinitTaskState_t newState)
Definition: taskdb.c:421
int crinitTaskDBSetTaskState(crinitTaskDB_t *ctx, crinitTaskState_t s, const char *taskName)
Definition: taskdb.c:204
int crinitTaskDBSetSpawnInhibit(crinitTaskDB_t *ctx, bool inh)
Definition: taskdb.c:186
int crinitTaskDBSpawnReady(crinitTaskDB_t *ctx)
Definition: taskdb.c:148
int crinitTaskDBGetTaskStateAndPID(crinitTaskDB_t *ctx, crinitTaskState_t *s, pid_t *pid, const char *taskName)
Definition: taskdb.c:290
int crinitTaskDBRemoveDepFromTask(crinitTaskDB_t *ctx, const crinitTaskDep_t *dep, const char *taskName)
Definition: taskdb.c:361
int crinitTaskDBFulfillDep(crinitTaskDB_t *ctx, const crinitTaskDep_t *dep, const crinitTask_t *target)
Definition: taskdb.c:390
int crinitTaskDBProvideFeatureByTaskName(crinitTaskDB_t *ctx, const char *taskName, crinitTaskState_t newState)
Definition: taskdb.c:442