#ifndef __POLLER_H__
|
|
#define __POLLER_H__
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
#include <stdint.h>
|
|
#include <time.h>
|
|
#include <glib.h>
|
|
#include "obj.h"
|
|
|
|
|
|
|
|
struct poller_item {
|
|
int fd;
|
|
struct obj *obj;
|
|
uintptr_t uintp;
|
|
|
|
void (*readable)(int, void *, uintptr_t);
|
|
void (*writeable)(int, void *, uintptr_t);
|
|
void (*closed)(int, void *, uintptr_t);
|
|
void (*timer)(int, void *, uintptr_t);
|
|
};
|
|
|
|
struct poller;
|
|
|
|
|
|
|
|
|
|
struct poller *poller_new(void);
|
|
int poller_add_item(struct poller *, struct poller_item *);
|
|
int poller_update_item(struct poller *, struct poller_item *);
|
|
int poller_del_item(struct poller *, int);
|
|
int poller_poll(struct poller *, int);
|
|
void poller_blocked(struct poller *, int);
|
|
int poller_isblocked(struct poller *, int);
|
|
void poller_error(struct poller *, int);
|
|
time_t poller_now(struct poller *);
|
|
|
|
int poller_add_timer(struct poller *, void (*)(void *), struct obj *);
|
|
int poller_del_timer(struct poller *, void (*)(void *), struct obj *);
|
|
|
|
|
|
#endif
|