/[guile]/guile/guile-core/libguile/coop.c
ViewVC logotype

Diff of /guile/guile-core/libguile/coop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by mvo, Sun Nov 3 22:05:10 2002 UTC revision 1.34 by mvo, Mon Nov 4 15:43:00 2002 UTC
# Line 223  coop_init () Line 223  coop_init ()
223  #endif  #endif
224  }  }
225    
 /* Return the next runnable thread. If no threads are currently runnable,  
    and there are sleeping threads - wait until one wakes up. Otherwise,  
    return NULL. */  
   
 coop_t *  
 coop_next_runnable_thread()  
 {  
   int sleepers;  
   coop_t *t;  
   time_t now;  
   
   do {  
     sleepers = 0;  
     now = time(NULL);  
   
     /* Check the sleeping queue */  
     while ((t = coop_qget(&coop_global_sleepq)) != NULL)  
       {  
         sleepers++;  
         if (t->wakeup_time <= now)  
           coop_qput(&coop_global_runq, t);  
         else  
           coop_qput(&coop_tmp_queue, t);  
       }  
     while ((t = coop_qget(&coop_tmp_queue)) != NULL)  
       coop_qput(&coop_global_sleepq, t);  
       
     t = coop_qget (&coop_global_runq);  
   
   } while ((t == NULL) && (sleepers > 0));  
   
   return t;  
 }  
   
226  void  void
227  coop_start()  coop_start()
228  {  {

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26