ioloop.h revision 59151b71059df1190acd75d8717ed04a7920c862
#ifndef __IOLOOP_H
#define __IOLOOP_H
#include <time.h>
struct io;
struct timeout;
struct ioloop;
enum io_condition {
IO_READ = 0x01,
IO_WRITE = 0x02,
/* IO_ERROR can be used to check when writable pipe's reader side
closes the pipe. For other uses IO_READ should work just as well. */
IO_ERROR = 0x04,
/* internal */
IO_NOTIFY = 0x08
};
typedef void io_callback_t(void *context);
typedef void timeout_callback_t(void *context);
/* Time when the I/O loop started calling handlers.
Can be used instead of time(NULL). */
extern time_t ioloop_time;
extern struct timeval ioloop_timeval;
extern struct timezone ioloop_timezone;
extern struct ioloop *current_ioloop;
/* You can create different handlers for IO_READ and IO_WRITE. IO_READ and
IO_ERROR can't use different handlers (and there's no point anyway).
Don't try to add multiple handlers for the same type. It's not checked and
the behavior will be undefined. */
void *context);
/* Remove I/O handler, and set io pointer to NULL. */
/* Timeout handlers */
void *context);
/* Remove timeout handler, and set timeout pointer to NULL. */
/* call these if you wish to run the iteration only once */
/* Destroy I/O loop and set ioloop pointer to NULL. */
#endif