root/src/noitd.c

Revision b62cf2be087943dcb29b6e068bd4262862fcb17d, 0.7 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 7 years ago)

more work... fleshing out the eventer

  • Property mode set to 100644
Line 
1 #include "noit_defines.h"
2 #include "eventer/eventer.h"
3
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 int stdin_handler(eventer_t e, int mask, void *closure, struct timeval *now) {
8   fprintf(stderr, "in stdin_handler:\n");
9   return EVENTER_READ;
10 }
11 void stdin_sample() {
12   eventer_t e;
13   e = eventer_alloc();
14   e->fd = 0;
15   e->mask = EVENTER_READ;
16   e->callback = stdin_handler;
17   eventer_add(e);
18 }
19 int main(int argc, char **argv) {
20   if(eventer_choose("kqueue") == -1) {
21     fprintf(stderr, "Cannot choose kqueue\n");
22     exit(-1);
23   }
24   if(eventer_init() == -1) {
25     fprintf(stderr, "Cannot init kqueue\n");
26     exit(-1);
27   }
28
29   stdin_sample();
30   eventer_loop();
31   return 0;
32 }
Note: See TracBrowser for help on using the browser.