Event Interface

The Event library is a utility library provided with Spread, but it is not required that you use it. It is simply provided to avoid everyone having to write their own event handling system.

/* Events priorities */

#define		LOW_PRIORITY	0
#define		HIGH_PRIORITY	2

/* Event routines */
int 	E_init();
sp_time	E_get_time();
sp_time	E_sub_time( sp_time t, sp_time delta_t );
sp_time	E_add_time( sp_time t, sp_time delta_t );
int	E_compare_time( sp_time t1, sp_time t2 );
int 	E_queue( void (* func)(), int code, void *data, sp_time delta_time );
int 	E_dequeue( void (* func)(), int code, void *data );
void	E_delay( sp_time t );

int	E_attach_fd( int fd, void (* func)(), int code, int priority );
int 	E_detach_fd( int fd );
void 	E_set_active_threshold( int priority );
int	E_num_active( int priority );

void 	E_handle_events();
void 	E_exit_events();