OLD | NEW |
1 /* | 1 /* |
2 * Compile with: | 2 * Compile with: |
3 * cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent | 3 * cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent |
4 */ | 4 */ |
5 #ifdef HAVE_CONFIG_H | 5 #ifdef HAVE_CONFIG_H |
6 #include "config.h" | 6 #include "config.h" |
7 #endif | 7 #endif |
8 | 8 |
| 9 #ifdef WIN32 |
| 10 #include <winsock2.h> |
| 11 #endif |
9 | 12 |
10 #include <sys/types.h> | 13 #include <sys/types.h> |
11 #include <sys/stat.h> | 14 #include <sys/stat.h> |
| 15 #ifdef HAVE_SYS_TIME_H |
12 #include <sys/time.h> | 16 #include <sys/time.h> |
| 17 #endif |
13 #include <fcntl.h> | 18 #include <fcntl.h> |
14 #include <stdlib.h> | 19 #include <stdlib.h> |
15 #include <stdio.h> | 20 #include <stdio.h> |
16 #include <string.h> | 21 #include <string.h> |
| 22 #ifdef HAVE_UNISTD_H |
17 #include <unistd.h> | 23 #include <unistd.h> |
| 24 #endif |
18 #include <errno.h> | 25 #include <errno.h> |
19 | 26 |
20 #include <event.h> | 27 #include <event.h> |
21 | 28 |
22 int called = 0; | 29 int called = 0; |
23 | 30 |
24 #define NEVENT 20000 | 31 #define NEVENT 20000 |
25 | 32 |
26 struct event *ev[NEVENT]; | 33 struct event *ev[NEVENT]; |
27 | 34 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 tv.tv_sec = 0; | 80 tv.tv_sec = 0; |
74 tv.tv_usec = rand_int(50000); | 81 tv.tv_usec = rand_int(50000); |
75 evtimer_add(ev[i], &tv); | 82 evtimer_add(ev[i], &tv); |
76 } | 83 } |
77 | 84 |
78 event_dispatch(); | 85 event_dispatch(); |
79 | 86 |
80 return (called < NEVENT); | 87 return (called < NEVENT); |
81 } | 88 } |
82 | 89 |
OLD | NEW |