3
* cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent
9
#include <sys/socket.h>
25
write_cb(int fd, short event, void *arg)
27
char *test = "test string";
30
len = write(fd, test, strlen(test) + 1);
32
printf("%s: write %d%s\n", __func__,
33
len, len ? "" : " - means EOF");
39
} else if (called == 1)
46
main (int argc, char **argv)
50
if (signal(SIGPIPE, SIG_IGN) == SIG_IGN)
53
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)
56
/* Initalize the event library */
59
/* Initalize one event */
60
event_set(&ev, pair[1], EV_WRITE, write_cb, &ev);