1TICKIT_WATCH_IO(3)         Library Functions Manual         TICKIT_WATCH_IO(3)
2
3
4

NAME

6       tickit_watch_io - invoke a callback when IO is possible
7

SYNOPSIS

9       #include <tickit.h>
10
11       typedef enum TickitIOCondition;
12
13       typedef struct {
14         int fd;
15         TickitIOCondition cond;
16       } TickitIOWatchInfo;
17
18       typedef int TickitCallbackFn(Tickit *t, TickitEventflags flags,
19           void *info, void *user);
20
21       void *tickit_watch_io(Tickit *t, int fd, TickitIOCondition cond,
22           TickitBindFlags flags, TickitCallbackFn *fn, void *user);
23
24       Link with -ltickit.
25

DESCRIPTION

27       tickit_watch_io()  registers  a  callback function to be invoked by the
28       toplevel event loop when IO operations are possible on a given file de‐
29       scriptor.  A  registered  callback will be invoked by a running call to
30       tickit_run(3). The callback function will be invoked whenever the  file
31       descriptor  is readable, writable, or in a hang-up condition, depending
32       on the requested condition types. The info  pointer  will  point  to  a
33       structure containing the file descriptor and a bitmask of the IO opera‐
34       tions currently possible.
35
36       The cond argument to tickit_watch_io() should be a bitmask of at  least
37       one of the following values:
38
39       TICKIT_IO_IN
40              The file descriptor is ready to perform an input operation, such
41              as reading bytes.
42
43       TICKIT_IO_OUT
44              The file descriptor is ready to  perform  an  output  operation,
45              such as writing bytes.
46
47       TICKIT_IO_HUP
48              The  file  descriptor  is in a hang-up condition. Typically this
49              means that a connection such as a socket or pipe has been closed
50              by the peer.
51
52       When the callback function is invoked, the info struct will contain the
53       file descriptor in the fd field, and the current IO conditions  in  the
54       cond  field. This may be one of the values given above, and in addition
55       may also be one of the following:
56
57       TICKIT_IO_ERR
58              The file descriptor is in an error condition.
59
60       TICKIT_IO_INVAL
61              The file descriptor itself is invalid and does not represent  an
62              open file.
63
64       If registered with the TICKIT_BIND_FIRST flag, the callback will be in‐
65       serted at the start of the queue, coming before others. If not,  it  is
66       appended at the end.
67
68       If cancelled by tickit_watch_cancel(3) the callback function is invoked
69       with just the TICKIT_EV_UNBIND flag if  it  had  been  registered  with
70       TICKIT_BIND_UNBIND.
71

RETURN VALUE

73       tickit_watch_io() returns an opaque identifier pointer.
74

SEE ALSO

76       tickit_new_stdio(3),                  tickit_watch_timer_after_msec(3),
77       tickit_watch_timer_at_epoch(3),                  tickit_watch_later(3),
78       tickit_watch_signal(3),    tickit_watch_process(3),   tickit_watch_can‐
79       cel(3), tickit(7)
80
81
82
83                                                            TICKIT_WATCH_IO(3)
Impressum