33 lines
608 B
C
33 lines
608 B
C
#ifndef _CRON_H
|
|
#define _CRON_H
|
|
|
|
#ifdef __cpluscplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include "timeout.h"
|
|
|
|
struct cron_task
|
|
{
|
|
struct timeout timeout;
|
|
void (*callback)(void *);
|
|
void *data;
|
|
uint64_t cycle;
|
|
};
|
|
|
|
struct thread_cron;
|
|
struct thread_cron *thread_cron_new(uint64_t now);
|
|
void thread_cron_free(struct thread_cron *cron);
|
|
void thread_cron_run(struct thread_cron *cron, uint64_t now);
|
|
|
|
void thread_cron_add_task(struct thread_cron *cron, struct cron_task *task);
|
|
void thread_cron_del_task(struct thread_cron *cron, struct cron_task *task);
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|