1 /* This file is part of Pazpar2.
2 Copyright (C) 2006-2013 Index Data
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
29 typedef struct iochan_man_s *iochan_man_t;
35 #define EVENT_INPUT 0x01
36 #define EVENT_OUTPUT 0x02
37 #define EVENT_EXCEPT 0x04
38 #define EVENT_TIMEOUT 0x08
53 iochan_man_t iochan_man_create(int no_threads);
54 void iochan_add(iochan_man_t man, IOCHAN chan);
55 void iochan_man_events(iochan_man_t man);
56 void iochan_man_destroy(iochan_man_t *mp);
58 #define iochan_destroy(i) (void)((i)->destroyed = 1)
59 #define iochan_getfd(i) ((i)->fd)
60 #define iochan_setfd(i, d) ((i)->fd = d)
61 #define iochan_getdata(i) ((i)->data)
62 #define iochan_setdata(i, d) ((i)->data = d)
63 #define iochan_setflags(i, d) ((i)->flags = d)
64 #define iochan_setflag(i, d) ((i)->flags |= d)
65 #define iochan_clearflag(i, d) ((i)->flags &= ~(d))
66 #define iochan_getflag(i, d) ((i)->flags & d ? 1 : 0)
67 #define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
68 #define iochan_activity(i) ((i)->last_event = time(0))
70 IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags, const char *name);
72 void pazpar2_sleep(double d);
78 * c-file-style: "Stroustrup"
79 * indent-tabs-mode: nil
81 * vim: shiftwidth=4 tabstop=8 expandtab