apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: apr/network_io/os2 poll.c
Date Sat, 18 Aug 2001 04:36:49 GMT
bjh         01/08/17 21:36:49

  Modified:    network_io/os2 poll.c
  Log:
  OS/2: Simplify & standardize apr_poll(), we usually want it to return if
  interrupted.
  
  Revision  Changes    Path
  1.24      +16 -18    apr/network_io/os2/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/os2/poll.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- poll.c	2001/08/10 21:04:48	1.23
  +++ poll.c	2001/08/18 04:36:48	1.24
  @@ -129,28 +129,26 @@
   {
       int i;
       int rv = 0;
  -    apr_time_t starttime = apr_time_now();
   
  -    do {
  -        for (i=0; i<pollfdset->num_total; i++) {
  -            pollfdset->r_socket_list[i] = pollfdset->socket_list[i];
  -        }
  -        
  -        rv = select(pollfdset->r_socket_list, 
  -                    pollfdset->num_read, 
  -                    pollfdset->num_write, 
  -                    pollfdset->num_except, 
  -                    timeout >= 0 ? timeout / 1000 : -1);
  +    for (i=0; i<pollfdset->num_total; i++) {
  +        pollfdset->r_socket_list[i] = pollfdset->socket_list[i];
  +    }
   
  -        if (rv < 0 && sock_errno() == SOCEINTR && timeout >= 0 )
{
  -            apr_interval_time_t elapsed = apr_time_now() - starttime;
  +    rv = select(pollfdset->r_socket_list,
  +                pollfdset->num_read,
  +                pollfdset->num_write,
  +                pollfdset->num_except,
  +                timeout >= 0 ? timeout / 1000 : -1);
   
  -            if (timeout <= elapsed)
  -                break;
  -
  -            timeout -= elapsed;
  +    /* select() doesn't wipe the socket list in the case of a timeout or
  +     * interrupt. This prevents false positives from revents_get
  +     */
  +    if (rv == 0) {
  +        for (i=0; i<pollfdset->num_total; i++) {
  +            pollfdset->r_socket_list[i] = -1;
           }
  -    } while ( rv < 0 && sock_errno() == SOCEINTR );
  +        return APR_TIMEUP;
  +    }
   
       (*nsds) = rv;
       return rv < 0 ? APR_OS2_STATUS(sock_errno()) : APR_SUCCESS;
  
  
  

Mime
View raw message