2009-06-06 17:43:50 +00:00
|
|
|
/*
|
|
|
|
* run_loop.h
|
|
|
|
*
|
|
|
|
* Created by Matthias Ringwald on 6/6/09.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2009-07-13 21:51:42 +00:00
|
|
|
#include "linked_list.h"
|
|
|
|
|
2009-06-06 17:43:50 +00:00
|
|
|
typedef struct data_source {
|
2009-07-13 21:51:42 +00:00
|
|
|
linked_item_t item;
|
2009-06-06 17:43:50 +00:00
|
|
|
int fd; // <-- file descriptors to watch or 0
|
|
|
|
int (*process)(struct data_source *ds, int ready); // <-- do processing, @return: more to do
|
|
|
|
} data_source_t;
|
|
|
|
|
|
|
|
typedef struct timer_source {
|
|
|
|
struct timer_source *next;
|
|
|
|
} timer_source_t;
|
|
|
|
|
|
|
|
void run_loop_add(data_source_t *dataSource); // <-- add DataSource to RunLoop
|
|
|
|
int run_loop_remove(data_source_t *dataSource); // <-- remove DataSource from RunLoop
|
|
|
|
void run_loop_execute(); // <-- execute configured RunLoop
|