MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / Cron_AddTask

Function Cron_AddTask

src/cron/cron.c:262–283  ·  view source on GitHub ↗

create a new CRON task

Source from the content-addressed store, hash-verified

260
261// create a new CRON task
262CronTaskHandle Cron_AddTask
263(
264 uint when, // number of miliseconds until task invocation
265 CronTaskCB work, // callback to call when task is due
266 CronTaskFree free, // [optional] task private data free function
267 void *pdata // [optional] private data to pass to callback
268) {
269 ASSERT(work != NULL);
270 ASSERT(cron != NULL);
271 ASSERT(!(free != NULL && pdata == NULL));
272
273 CRON_TASK *task = rm_malloc(sizeof(CRON_TASK));
274
275 task->cb = work;
276 task->due = due_in_ms(when);
277 task->free = free;
278 task->pdata = pdata;
279
280 CRON_InsertTask(task);
281
282 return (uintptr_t)task;
283}
284
285// tries to abort given task
286// in case task is currently being executed, it will wait for it to finish

Callers 9

Query_SetTimeOutFunction · 0.85
CronTask_RecurringTaskFunction · 0.85
test_cronExecFunction · 0.85
test_cronAbortFunction · 0.85
test_cronLateAbortFunction · 0.85
test_MultiAbortFunction · 0.85
test_AbortRunningTaskFunction · 0.85

Calls 3

rm_mallocFunction · 0.85
due_in_msFunction · 0.85
CRON_InsertTaskFunction · 0.85

Tested by 6

test_cronExecFunction · 0.68
test_cronAbortFunction · 0.68
test_cronLateAbortFunction · 0.68
test_MultiAbortFunction · 0.68
test_AbortRunningTaskFunction · 0.68