scheduler.c

Basic task scheduling library
git clone git://git.finwo.net/lib/scheduler.c
Log | Files | Refs | README | LICENSE

scheduler.h (624B)


      1 #ifndef __FINWO_SCHEDULER_H__
      2 #define __FINWO_SCHEDULER_H__
      3 
      4 #include <stdint.h>
      5 #include <sys/select.h>
      6 
      7 #define SCHED_RUNNING 0
      8 #define SCHED_DONE    1
      9 #define SCHED_ERROR   2
     10 
     11 typedef struct pt_task pt_task_t;
     12 
     13 typedef int (*pt_task_fn)(int64_t timestamp, pt_task_t *task);
     14 
     15 struct pt_task {
     16   struct pt_task *next;
     17   pt_task_fn      func;
     18   void           *udata;
     19   char            is_active;
     20   int             maxfd;
     21 };
     22 
     23 pt_task_t *sched_create(pt_task_fn fn, void *udata);
     24 int        sched_remove(pt_task_t *task);
     25 int        sched_main(void);
     26 int        sched_has_data(int *in_fds);
     27 
     28 #endif  // __FINWO_SCHEDULER_H__