Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib/ioloop-internal.h @ 9354:687ac828b964 HEAD
lib-index: modseqs weren't tracked properly within session when changes were done.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 01 Sep 2009 13:05:03 -0400 |
parents | 86c28d14ddeb |
children |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
5330
diff
changeset
|
1 #ifndef IOLOOP_INTERNAL_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
5330
diff
changeset
|
2 #define IOLOOP_INTERNAL_H |
0 | 3 |
7098
becdf2eacdce
Use priority queue to implement timeout handling. Added timeout_reset().
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
4 #include "priorityq.h" |
0 | 5 #include "ioloop.h" |
6 | |
4573
8d977716f449
Rewrote much of the kqueue code. It didn't work correctly if there were both
Timo Sirainen <tss@iki.fi>
parents:
3959
diff
changeset
|
7 #ifndef IOLOOP_INITIAL_FD_COUNT |
8d977716f449
Rewrote much of the kqueue code. It didn't work correctly if there were both
Timo Sirainen <tss@iki.fi>
parents:
3959
diff
changeset
|
8 # define IOLOOP_INITIAL_FD_COUNT 128 |
8d977716f449
Rewrote much of the kqueue code. It didn't work correctly if there were both
Timo Sirainen <tss@iki.fi>
parents:
3959
diff
changeset
|
9 #endif |
8d977716f449
Rewrote much of the kqueue code. It didn't work correctly if there were both
Timo Sirainen <tss@iki.fi>
parents:
3959
diff
changeset
|
10 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
11 struct ioloop { |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
12 struct ioloop *prev; |
0 | 13 |
5248
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
14 struct io_file *io_files; |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
15 struct io_file *next_io_file; |
7098
becdf2eacdce
Use priority queue to implement timeout handling. Added timeout_reset().
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
16 struct priorityq *timeouts; |
0 | 17 |
3483
84a4f150bd00
data -> context/ctx naming convention replaces
Timo Sirainen <tss@iki.fi>
parents:
3482
diff
changeset
|
18 struct ioloop_handler_context *handler_context; |
3482
465c465c66be
Added inotify patch by Johannes Berg and did some restructuring to
Timo Sirainen <tss@iki.fi>
parents:
2496
diff
changeset
|
19 struct ioloop_notify_handler_context *notify_handler_context; |
8634
86c28d14ddeb
Added io_loop_set_max_fd_count() to specify how many fds we expect to use.
Timo Sirainen <tss@iki.fi>
parents:
8366
diff
changeset
|
20 unsigned int max_fd_count; |
0 | 21 |
22 unsigned int running:1; | |
23 }; | |
24 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
25 struct io { |
1752 | 26 enum io_condition condition; |
0 | 27 |
1036
f782b3319553
Removed useless parameters from io_callback_t and timeout_callback_t.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
28 io_callback_t *callback; |
10
82b7de533f98
s/user_data/context/ and some s/Data/Context/
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
29 void *context; |
8366
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
30 |
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
31 struct ioloop *ioloop; |
0 | 32 }; |
33 | |
5248
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
34 struct io_file { |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
35 struct io io; |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
36 |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
37 /* use a doubly linked list so that io_remove() is quick */ |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
38 struct io_file *prev, *next; |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
39 |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
40 int refcount; |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
41 int fd; |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
42 }; |
12ac5f685814
Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents:
4579
diff
changeset
|
43 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
44 struct timeout { |
7098
becdf2eacdce
Use priority queue to implement timeout handling. Added timeout_reset().
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
45 struct priorityq_item item; |
0 | 46 |
1499
e850252cdc7e
Removed I/O priorities. They were pretty much useless and were just getting
Timo Sirainen <tss@iki.fi>
parents:
1431
diff
changeset
|
47 unsigned int msecs; |
7098
becdf2eacdce
Use priority queue to implement timeout handling. Added timeout_reset().
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
48 struct timeval next_run; |
0 | 49 |
1036
f782b3319553
Removed useless parameters from io_callback_t and timeout_callback_t.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
50 timeout_callback_t *callback; |
10
82b7de533f98
s/user_data/context/ and some s/Data/Context/
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
51 void *context; |
8366
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
52 |
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
53 struct ioloop *ioloop; |
0 | 54 }; |
55 | |
7152
3e506d46655f
timeout_get_wait_time() may have returned negative seconds in timeval. Also
Timo Sirainen <tss@iki.fi>
parents:
7098
diff
changeset
|
56 int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r, |
0 | 57 struct timeval *tv_now); |
7098
becdf2eacdce
Use priority queue to implement timeout handling. Added timeout_reset().
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
58 void io_loop_handle_timeouts(struct ioloop *ioloop); |
0 | 59 |
60 /* I/O handler calls */ | |
8366
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
61 void io_loop_handle_add(struct io_file *io); |
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
62 void io_loop_handle_remove(struct io_file *io, bool closed); |
0 | 63 |
8634
86c28d14ddeb
Added io_loop_set_max_fd_count() to specify how many fds we expect to use.
Timo Sirainen <tss@iki.fi>
parents:
8366
diff
changeset
|
64 void io_loop_handler_init(struct ioloop *ioloop, unsigned int initial_fd_count); |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
65 void io_loop_handler_deinit(struct ioloop *ioloop); |
0 | 66 |
8366
2c111b572eee
Don't break if io_remove() or timeout_remove() are called for non-active ioloops.
Timo Sirainen <tss@iki.fi>
parents:
8100
diff
changeset
|
67 void io_loop_notify_remove(struct io *io); |
3482
465c465c66be
Added inotify patch by Johannes Berg and did some restructuring to
Timo Sirainen <tss@iki.fi>
parents:
2496
diff
changeset
|
68 void io_loop_notify_handler_deinit(struct ioloop *ioloop); |
465c465c66be
Added inotify patch by Johannes Berg and did some restructuring to
Timo Sirainen <tss@iki.fi>
parents:
2496
diff
changeset
|
69 |
0 | 70 #endif |