]> granicus.if.org Git - apache/blob - test/test_select.c
describe the recent changes to mod_headers (%%, envclause everywhere)
[apache] / test / test_select.c
1 /* Copyright 1999-2004 The Apache Software Foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 /* This is just a quick test program to see how long a wait is
17  * produced by a select loop with an exponential backoff.
18  *
19  *   gcc -g -O2 -o test_select test_select.c
20  *   test_select
21  *
22  * Roy Fielding, 1996
23  */
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <sys/time.h>
28
29 int main (void)
30 {
31     int srv;
32     long waittime = 4096;
33     struct timeval tv;
34
35     printf("Start\n");
36     while ((waittime > 0) && (waittime < 3000000)) {
37         printf("%d\n", waittime);
38         tv.tv_sec  = waittime/1000000;
39         tv.tv_usec = waittime%1000000;
40         waittime <<= 1;
41         srv = select(0, NULL, NULL, NULL, &tv);
42     }
43     printf("End\n");
44     exit(0);
45 }