OSSP CVS Repository

ossp - Check-in [2779]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2779
Date: 2002-Nov-08 17:17:47 (local)
2002-Nov-08 16:17:47 (UTC)
User:rse
Branch:
Comment: Make sure that in the even manager a polling-only select(2) call uses a correctly initialized timeout parameter. Because SUSv3 says: "Upon successful completion, the select() function may modify the object pointed to by the timeout argument."
Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.594 -> 1.595     4 inserted, 0 deleted
ossp-pkg/pth/pth_sched.c      1.85 -> 1.86     2 inserted, 3 deleted

ossp-pkg/pth/ChangeLog 1.594 -> 1.595

--- ChangeLog    2002/11/08 16:05:54     1.594
+++ ChangeLog    2002/11/08 16:17:47     1.595
@@ -21,6 +21,10 @@
                   
   Changes between 2.0b0 and 2.0b1 (07-Nov-2002 to xx-Nov-2002)
 
+   *) Make sure that in the even manager a polling-only select(2) call
+      uses a correctly initialized timeout parameter.
+      [Ralf S. Engelschall]
+
    *) Added soft and hard syscall mapping for nanosleep(3) and
       usleep(3) functions. 
       [Ralf S. Engelschall]


ossp-pkg/pth/pth_sched.c 1.85 -> 1.86

--- pth_sched.c  2002/11/07 15:38:40     1.85
+++ pth_sched.c  2002/11/08 16:17:47     1.86
@@ -655,9 +655,6 @@
        additionally if a thread has one occurred event, we move it from the
        waiting queue to the ready queue */
 
-    /* pre-configure a raw polling timeout for later checks (see below) */
-    pth_time_set(&delay, PTH_TIME_ZERO);
-
     /* for all threads in the waiting queue... */
     t = pth_pqueue_head(&pth_WQ);
     while (t != NULL) {
@@ -693,6 +690,7 @@
                                 FD_SET(ev->ev_args.FD.fd, &wfds);
                             if (ev->ev_goal & PTH_UNTIL_FD_EXCEPTION)
                                 FD_SET(ev->ev_args.FD.fd, &efds);
+                            pth_time_set(&delay, PTH_TIME_ZERO);
                             while ((rc2 = pth_sc(select)(ev->ev_args.FD.fd+1, &rfds, &wfds, &efds, &delay)) < 0
                                    && errno == EINTR) ;
                             if (rc2 > 0) {
@@ -748,6 +746,7 @@
                                 memcpy(&tefds, ev->ev_args.SELECT.efds, sizeof(efds));
                                 pefds = &tefds;
                             }
+                            pth_time_set(&delay, PTH_TIME_ZERO);
                             while ((rc2 = pth_sc(select)(ev->ev_args.SELECT.nfd+1, prfds, pwfds, pefds, &delay)) < 0
                                    && errno == EINTR) ;
                             if (rc2 < 0) {

CVSTrac 2.0.1