14#define CRINIT_MONITOR_DEP_NAME "@crinitmon"
15#define CRINIT_PROVIDE_DEP_NAME "@provided"
16#define CRINIT_TASKDB_INITIAL_SIZE 256
51#define crinitTaskDbForEach(taskDb, task) \
52 for ((task) = (taskDb)->taskSet; (task) != (taskDb)->taskSet + (taskDb)->taskSetItems; (task)++)
75#define crinitTaskDBUpdate(ctx, t) crinitTaskDBInsert(ctx, t, true)
318#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:14
bool spawnInhibit
Specifies if process spawning is currently inhibited, respected by crinitTaskDBSpawnReady().
Definition taskdb.h:38
size_t taskSetSize
Current maximum size of the task array.
Definition taskdb.h:31
int(* spawnFunc)(struct crinitTaskDB_t *ctx, const crinitTask_t *, crinitDispatchThreadMode_t mode)
Definition taskdb.h:35
pthread_cond_t changed
Condition variable to be signalled if taskSet or spawnInhibit is changed.
Definition taskdb.h:42
pthread_mutex_t lock
Definition taskdb.h:40
size_t taskSetItems
Number of elements in the task array.
Definition taskdb.h:32
crinitTask_t * taskSet
Dynamic array of tasks, corresponds to task configs specified in the series config.
Definition taskdb.h:30
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:102
int crinitTaskDBDestroy(crinitTaskDB_t *ctx)
Definition taskdb.c:82
int crinitTaskDBGetTaskState(crinitTaskDB_t *ctx, crinitTaskState_t *s, const char *taskName)
Definition taskdb.c:311
int crinitTaskDBExportTaskNamesToArray(crinitTaskDB_t *ctx, char **tasks[], size_t *numTasks)
Definition taskdb.c:575
int crinitTaskDBSetTaskPID(crinitTaskDB_t *ctx, pid_t pid, const char *taskName)
Definition taskdb.c:331
int crinitTaskDBAddDepToTask(crinitTaskDB_t *ctx, const crinitTaskDep_t *dep, const char *taskName)
Definition taskdb.c:422
int crinitTaskDBSpawnReady(crinitTaskDB_t *ctx, crinitDispatchThreadMode_t mode)
Definition taskdb.c:162
int crinitTaskDBInitWithSize(crinitTaskDB_t *ctx, int(*spawnFunc)(crinitTaskDB_t *ctx, const crinitTask_t *, crinitDispatchThreadMode_t mode), size_t initialSize)
Definition taskdb.c:42
int crinitTaskDBGetTaskPID(crinitTaskDB_t *ctx, pid_t *pid, const char *taskName)
Definition taskdb.c:350
int crinitTaskDBProvideFeature(crinitTaskDB_t *ctx, const crinitTask_t *provider, crinitTaskState_t newState)
Definition taskdb.c:531
int crinitTaskDBSetTaskState(crinitTaskDB_t *ctx, crinitTaskState_t s, const char *taskName)
Definition taskdb.c:241
int crinitTaskDBSetSpawnInhibit(crinitTaskDB_t *ctx, bool inh)
Definition taskdb.c:200
int crinitTaskDBGetTaskStateAndPID(crinitTaskDB_t *ctx, crinitTaskState_t *s, pid_t *pid, const char *taskName)
Definition taskdb.c:370
int crinitTaskDBGetTaskByName(crinitTaskDB_t *ctx, crinitTask_t **task, const char *taskName)
Definition taskdb.c:218
int crinitTaskDBRemoveDepFromTask(crinitTaskDB_t *ctx, const crinitTaskDep_t *dep, const char *taskName)
Definition taskdb.c:471
crinitDispatchThreadMode_t
Definition taskdb.h:21
@ CRINIT_DISPATCH_THREAD_MODE_START
Definition taskdb.h:22
@ CRINIT_DISPATCH_THREAD_MODE_STOP
Definition taskdb.h:23
int crinitTaskDBRemit(crinitTaskDB_t *ctx)
Definition taskdb.c:409
int crinitTaskDBFulfillDep(crinitTaskDB_t *ctx, const crinitTaskDep_t *dep, const crinitTask_t *target)
Definition taskdb.c:500
int crinitTaskDBProvideFeatureByTaskName(crinitTaskDB_t *ctx, const char *taskName, crinitTaskState_t newState)
Definition taskdb.c:557
crinitTask_t * crinitTaskDBBorrowTask(crinitTaskDB_t *ctx, const char *taskName)
Definition taskdb.c:392