00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #if !defined(_SCHEDULE_H_)
00040 #define _SCHEDULE_H_
00041
00042 typedef struct sp_sched_state_s sp_sched_state_t;
00043
00044 typedef void (*sp_sched_callback_func_t)(sp_sched_state_t *s, void *user_data);
00045
00046 typedef struct
00047 {
00048 uint64_t when;
00049 sp_sched_callback_func_t callback;
00050 void *user_data;
00051 } sp_sched_t;
00052
00053 struct sp_sched_state_s
00054 {
00055 uint64_t ticker;
00056 int allocated;
00057 int max_to_date;
00058 sp_sched_t *sched;
00059 };
00060
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif
00064
00065 uint64_t sp_schedule_next(sp_sched_state_t *s);
00066 uint64_t sp_schedule_time(sp_sched_state_t *s);
00067 void sp_schedule_run(sp_sched_state_t *s);
00068
00069 int sp_schedule_event(sp_sched_state_t *s, int ms, void (*function)(sp_sched_state_t *s, void *data), void *user_data);
00070 void sp_schedule_update(sp_sched_state_t *s, int samples);
00071 void sp_schedule_del(sp_sched_state_t *s, int id);
00072
00073 sp_sched_state_t *sp_schedule_init(sp_sched_state_t *s);
00074 int sp_schedule_release(sp_sched_state_t *s);
00075
00076 #ifdef __cplusplus
00077 }
00078 #endif
00079
00080 #endif
00081