annotate src/lib/ioloop-internal.h @ 5330:1dcd1631f06e HEAD

If poll()/etc. timeouts, we didn't handle time timeouts immediately but called poll()/etc again with zero timeout and then handled the timeouts.
author Timo Sirainen <tss@iki.fi>
date Thu, 15 Mar 2007 16:38:25 +0200
parents 12ac5f685814
children e4eb71ae8e96
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __IOLOOP_INTERNAL_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __IOLOOP_INTERNAL_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 #include "ioloop.h"
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5
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
6 #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
7 # 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
8 #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
9
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
10 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
11 struct ioloop *prev;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12
5248
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
13 struct io_file *io_files;
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
14 struct io_file *next_io_file;
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
15 struct timeout *timeouts; /* sorted by next_run */
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
16
3483
84a4f150bd00 data -> context/ctx naming convention replaces
Timo Sirainen <tss@iki.fi>
parents: 3482
diff changeset
17 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
18 struct ioloop_notify_handler_context *notify_handler_context;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
19
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
20 unsigned int running:1;
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
21 };
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
22
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
23 struct io {
1752
fff38df7f98f s/int/enum io_condition/
Timo Sirainen <tss@iki.fi>
parents: 1729
diff changeset
24 enum io_condition condition;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
25
1036
f782b3319553 Removed useless parameters from io_callback_t and timeout_callback_t.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
26 io_callback_t *callback;
10
82b7de533f98 s/user_data/context/ and some s/Data/Context/
Timo Sirainen <tss@iki.fi>
parents: 0
diff changeset
27 void *context;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 };
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29
5248
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
30 struct io_file {
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
31 struct io io;
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
32
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
33 /* 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
34 struct io_file *prev, *next;
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
35
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
36 int refcount;
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
37 int fd;
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
38 };
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
39
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
40 struct timeout {
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
41 struct timeout *next;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
43 struct timeval next_run;
1499
e850252cdc7e Removed I/O priorities. They were pretty much useless and were just getting
Timo Sirainen <tss@iki.fi>
parents: 1431
diff changeset
44 unsigned int msecs;
e850252cdc7e Removed I/O priorities. They were pretty much useless and were just getting
Timo Sirainen <tss@iki.fi>
parents: 1431
diff changeset
45
e850252cdc7e Removed I/O priorities. They were pretty much useless and were just getting
Timo Sirainen <tss@iki.fi>
parents: 1431
diff changeset
46 unsigned int run_now:1;
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 destroyed:1;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
48
1036
f782b3319553 Removed useless parameters from io_callback_t and timeout_callback_t.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
49 timeout_callback_t *callback;
10
82b7de533f98 s/user_data/context/ and some s/Data/Context/
Timo Sirainen <tss@iki.fi>
parents: 0
diff changeset
50 void *context;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
51 };
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
52
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
53 int io_loop_get_wait_time(struct timeout *timeout, struct timeval *tv,
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
54 struct timeval *tv_now);
5330
1dcd1631f06e If poll()/etc. timeouts, we didn't handle time timeouts immediately but
Timo Sirainen <tss@iki.fi>
parents: 5248
diff changeset
55 void io_loop_handle_timeouts(struct ioloop *ioloop, bool update_run_now);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
57 /* I/O handler calls */
5248
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
58 void io_loop_handle_add(struct ioloop *ioloop, struct io_file *io);
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
59 void io_loop_handle_remove(struct ioloop *ioloop, struct io_file *io);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
60
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
61 void io_loop_handler_init(struct ioloop *ioloop);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 10
diff changeset
62 void io_loop_handler_deinit(struct ioloop *ioloop);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63
5248
12ac5f685814 Various cleanups to ioloop code.
Timo Sirainen <tss@iki.fi>
parents: 4579
diff changeset
64 void io_loop_notify_remove(struct ioloop *ioloop, 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
65 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
66
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 #endif