X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Feventl.h;h=515b7f290ff8a505f0dda575d358c300fcecc0ae;hb=37ae4386bd764d62ae43c68df1560be55ff813ca;hp=9bf2ca579877f9ad80c12a5a10430149aa7fe50a;hpb=e107b0011a295ccc61502d6e5ea79d9125a3fbb4;p=pazpar2-moved-to-github.git diff --git a/src/eventl.h b/src/eventl.h index 9bf2ca5..515b7f2 100644 --- a/src/eventl.h +++ b/src/eventl.h @@ -1,5 +1,5 @@ /* This file is part of Pazpar2. - Copyright (C) 2006-2008 Index Data + Copyright (C) Index Data Pazpar2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -26,6 +26,8 @@ struct iochan; typedef void (*IOC_CALLBACK)(struct iochan *i, int event); +typedef struct iochan_man_s *iochan_man_t; + typedef struct iochan { int fd; @@ -34,35 +36,47 @@ typedef struct iochan #define EVENT_OUTPUT 0x02 #define EVENT_EXCEPT 0x04 #define EVENT_TIMEOUT 0x08 -#define EVENT_WORK 0x10 - int force_event; IOC_CALLBACK fun; void *data; int destroyed; time_t last_event; time_t max_idle; - + int this_event; + int thread_users; + + iochan_man_t man; + char *name; struct iochan *next; + int poll_offset; } *IOCHAN; -#define iochan_destroy(i) (void)((i)->destroyed = 1) + +iochan_man_t iochan_man_create(int no_threads, int max_sockets); +int iochan_add(iochan_man_t man, IOCHAN chan, int slack); +void iochan_man_events(iochan_man_t man); +void iochan_man_destroy(iochan_man_t *mp); +void iochan_destroy(IOCHAN chan); + #define iochan_getfd(i) ((i)->fd) -#define iochan_setfd(i, f) ((i)->fd = (f)) +#define iochan_setfd(i, d) ((i)->fd = d) #define iochan_getdata(i) ((i)->data) #define iochan_setdata(i, d) ((i)->data = d) -#define iochan_getflags(i) ((i)->flags) #define iochan_setflags(i, d) ((i)->flags = d) #define iochan_setflag(i, d) ((i)->flags |= d) #define iochan_clearflag(i, d) ((i)->flags &= ~(d)) #define iochan_getflag(i, d) ((i)->flags & d ? 1 : 0) -#define iochan_getfun(i) ((i)->fun) -#define iochan_setfun(i, d) ((i)->fun = d) -#define iochan_setevent(i, e) ((i)->force_event = (e)) -#define iochan_getnext(i) ((i)->next) #define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0)) #define iochan_activity(i) ((i)->last_event = time(0)) -IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags); -int event_loop(IOCHAN *iochans); +IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags, const char *name); #endif +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +