From: David McCreedy Date: Wed, 9 Mar 2005 22:50:14 +0000 (+0000) Subject: Changed tpf/os.c's tpf_select function to bump the passed select timeout value by... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4daebbf1b6f94aef66eecc5fb1358b1b30691a5;p=thirdparty%2Fapache%2Fhttpd.git Changed tpf/os.c's tpf_select function to bump the passed select timeout value by 1 second. This is needed because TPF's select waits between timeout-1 and timeout seconds. Also renamed 'timeout' variable to clarify when it is used for seconds vs. milliseconds. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@156700 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/os/tpf/os.c b/src/os/tpf/os.c index 9c79e0f5163..a5d639b8546 100644 --- a/src/os/tpf/os.c +++ b/src/os/tpf/os.c @@ -55,12 +55,13 @@ int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts, int no_reads = 0; int no_writes = 0; int no_excepts = 0; - int timeout = 0; + int timeout_seconds = 0; + int timeout_millisec = 0; int rv = 0; if(maxfds) { if(tv) - timeout = tv->tv_sec * 1000 + tv->tv_usec; + timeout_millisec = tv->tv_sec * 1000 + tv->tv_usec; sockets[0] = maxfds-1; no_reads++; } @@ -78,24 +79,28 @@ int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts, #ifdef TPF_HAVE_SAWNC struct ev0bk evnblock; #endif - timeout = tv->tv_sec; + /* event processing uses seconds, select uses milliseconds */ + timeout_seconds = tv->tv_sec; if (tv->tv_usec) { - timeout++; /* round up to seconds (like TPF's select does) */ + timeout_seconds++; /* round up to seconds (like TPF's select does) */ } - if (timeout > 0) { /* paranoid check for valid timeout */ + if (timeout_seconds > 0) { /* paranoid check for valid timeout */ #ifdef TPF_HAVE_SAWNC evnblock.evnpstinf.evnbkc1 = 1; /* nbr of posts needed */ - evntc(&evnblock, EVENT_CNT, 'N', timeout, EVNTC_1052); + evntc(&evnblock, EVENT_CNT, 'N', timeout_seconds, EVNTC_1052); tpf_sawnc(&evnblock, EVENT_CNT); #else - sleep(timeout); + sleep(timeout_seconds); #endif } } else { - if (timeout < 0) { /* paranoid check for valid timeout */ - timeout = 0; + if (timeout_millisec < 0) { /* paranoid check for valid timeout */ + timeout_millisec = 0; } - rv = select(sockets, no_reads, no_writes, no_excepts, timeout); + if (timeout_millisec != 0) + timeout_millisec += 1000; + + rv = select(sockets, no_reads, no_writes, no_excepts, timeout_millisec); } ap_check_signals();