-DUSE_POLL fix

[email protected] (Andreas Gustafsson) Thu, 29 Apr 2004 14:39:56 -0700 (PDT)
Newsgroups gmane.comp.lib.state-threads.devel
Message-ID <[email protected]>
Due to an oversight in the timer performance patch I submitted in
October, the timer code in st-1.5.0 does not compile when USE_POLL
is defined.  The enclosed patch will fix it.
-- 
Andreas Gustafsson, [email protected]

--- st-1.5.0/sched.c.orig	2004-01-11 14:21:55.000000000 -0800
+++ st-1.5.0/sched.c	2004-04-22 18:25:49.000000000 -0700
@@ -477,10 +477,13 @@
   }
   ST_ASSERT(pollfds <= _ST_POLLFDS + _ST_POLLFDS_SIZE);
 
-  if (ST_CLIST_IS_EMPTY(&_ST_SLEEPQ)) {
+  if (_ST_SLEEPQ == NULL) {
     timeout = -1;
   } else {
-    min_timeout = (_ST_THREAD_PTR(_ST_SLEEPQ.next))->sleep;
+    if (_ST_SLEEPQ->due <= _st_this_vp.last_clock)
+      min_timeout = 0;
+    else
+      min_timeout = _ST_SLEEPQ->due - _st_this_vp.last_clock;
     timeout = (int) (min_timeout / 1000);
   }
 


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click