X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Feventl.h;h=e4d8b6b5c154f4b197110f3ac8f18c7e2c86ecf6;hb=b5b08cf342a8d5a0779670e7df649329111b4725;hp=595d85876baba03f8604ed491cb225f1dae2e47e;hpb=cc29eab9f928f6cd0f4231cb2e554e2ac7b0b1f3;p=pazpar2-moved-to-github.git diff --git a/src/eventl.h b/src/eventl.h index 595d858..e4d8b6b 100644 --- a/src/eventl.h +++ b/src/eventl.h @@ -1,7 +1,5 @@ -/* $Id: eventl.h,v 1.4 2007-04-10 08:48:56 adam Exp $ - Copyright (c) 2006-2007, Index Data. - -This file is part of Pazpar2. +/* This file is part of Pazpar2. + Copyright (C) 2006-2010 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 @@ -14,10 +12,10 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Pazpar2; see the file LICENSE. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - */ +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ #ifndef EVENTL_H #define EVENTL_H @@ -27,6 +25,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct iochan; typedef void (*IOC_CALLBACK)(struct iochan *i, int event); +typedef int (*IOC_SOCKETFUN)(struct iochan *i); +typedef int (*IOC_MASKFUN)(struct iochan *i); + +typedef struct iochan_man_s *iochan_man_t; typedef struct iochan { @@ -36,17 +38,28 @@ 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; + IOC_SOCKETFUN socketfun; + IOC_MASKFUN maskfun; 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; } *IOCHAN; + +iochan_man_t iochan_man_create(int no_threads); +void iochan_add(iochan_man_t man, IOCHAN chan); +void iochan_man_events(iochan_man_t man); +void iochan_man_destroy(iochan_man_t *mp); + #define iochan_destroy(i) (void)((i)->destroyed = 1) #define iochan_getfd(i) ((i)->fd) #define iochan_setfd(i, f) ((i)->fd = (f)) @@ -60,11 +73,22 @@ typedef struct iochan #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)) +#define iochan_setsocketfun(i, f) ((i)->socketfun = (f)) +#define iochan_getsocketfun(i) ((i)->socketfun) +#define iochan_setmaskfun(i, f) ((i)->maskfun = (f)) +#define iochan_getmaskfun(i) ((i)->maskfun) -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 + */ +