Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib/ioloop.h @ 903:fd8888f6f037 HEAD
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 05 Jan 2003 15:09:51 +0200 |
parents | efa46e28a0d7 |
children | 411006be3c66 |
rev | line source |
---|---|
0 | 1 #ifndef __IOLOOP_H |
2 #define __IOLOOP_H | |
3 | |
4 #include <time.h> | |
5 | |
6 #define IO_READ (1 << 0) | |
7 #define IO_WRITE (1 << 1) | |
8 | |
9 #define IO_PRIORITY_LOW 100 | |
10 #define IO_PRIORITY_DEFAULT 0 | |
11 #define IO_PRIORITY_HIGH -100 | |
12 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
13 struct io; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
14 struct timeout; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
15 struct ioloop; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
16 |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
17 typedef void (*IOFunc) (void *context, int fd, struct io *io); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
18 typedef void (*TimeoutFunc) (void *context, struct timeout *timeout); |
0 | 19 |
20 /* Time when the I/O loop started calling handlers. | |
21 Can be used instead of time(NULL). */ | |
22 extern time_t ioloop_time; | |
23 extern struct timeval ioloop_timeval; | |
492
efa46e28a0d7
Fixes to timezone handling which were handling quite badly. added
Timo Sirainen <tss@iki.fi>
parents:
389
diff
changeset
|
24 extern struct timezone ioloop_timezone; |
0 | 25 |
26 /* I/O listeners - you can create different handlers for IO_READ and IO_WRITE, | |
27 but make sure you don't create multiple handlers of same type, it's not | |
28 checked and removing one will stop the other from working as well. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
29 struct io *io_add(int fd, int condition, IOFunc func, void *context); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
30 struct io *io_add_priority(int fd, int priority, int condition, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
31 IOFunc func, void *context); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
32 void io_remove(struct io *io); |
0 | 33 |
34 /* Timeout handlers */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
35 struct timeout *timeout_add(int msecs, TimeoutFunc func, void *context); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
36 void timeout_remove(struct timeout *timeout); |
0 | 37 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
38 void io_loop_run(struct ioloop *ioloop); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
39 void io_loop_stop(struct ioloop *ioloop); /* safe to run in signal handler */ |
0 | 40 |
41 /* call these if you wish to run the iteration only once */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
42 void io_loop_set_running(struct ioloop *ioloop); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
43 void io_loop_handler_run(struct ioloop *ioloop); |
0 | 44 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
45 struct ioloop *io_loop_create(pool_t pool); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
46 void io_loop_destroy(struct ioloop *ioloop); |
0 | 47 |
48 #endif |