]> granicus.if.org Git - apache/blob - test/test_select.c
Final .dsp changes to produce the lightest weight builds
[apache] / test / test_select.c
1 /* This is just a quick test program to see how long a wait is
2  * produced by a select loop with an exponential backoff.
3  *
4  *   gcc -g -O2 -o test_select test_select.c
5  *   test_select
6  *
7  * Roy Fielding, 1996
8  */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <sys/time.h>
13
14 int main (void)
15 {
16     int srv;
17     long waittime = 4096;
18     struct timeval tv;
19
20     printf("Start\n");
21     while ((waittime > 0) && (waittime < 3000000)) {
22         printf("%d\n", waittime);
23         tv.tv_sec  = waittime/1000000;
24         tv.tv_usec = waittime%1000000;
25         waittime <<= 1;
26         srv = select(0, NULL, NULL, NULL, &tv);
27     }
28     printf("End\n");
29     exit(0);
30 }