FACT++  1.0
static int get_minimum ( int  deltat)
static

Definition at line 555 of file dtq.c.

References dll_get_next(), MAX_TIMER_QUEUES, QUEUE_ENT::queue_head, queue_id, SPECIAL_QUEUE, timer_entry::time, timer_entry::time_left, and WRITE_QUEUE.

Referenced by dtq_add_entry(), and stop_it().

556 {
557  TIMR_ENT *auxp, *queue_head;
558  int queue_id;
559  int min_time = 100000;
560 
561  queue_head = timer_queues[WRITE_QUEUE].queue_head;
562  if( dll_get_next((DLL *)queue_head,(DLL *)queue_head))
563  min_time = -10;
564  if((min_time != -10) || deltat)
565  {
566  if( (queue_head = timer_queues[SPECIAL_QUEUE].queue_head) != NULL)
567  {
568  auxp = queue_head;
569  while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
570  {
571  auxp->time_left -= deltat;
572  if(auxp->time_left > 0)
573  {
574  if(auxp->time_left < min_time)
575  {
576  min_time = auxp->time_left;
577  }
578  }
579  }
580  }
581  for( queue_id = 0; queue_id < MAX_TIMER_QUEUES; queue_id++ )
582  {
583  if( (queue_head = timer_queues[queue_id].queue_head) == NULL )
584  continue;
585  auxp = queue_head;
586  while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
587  {
588  auxp->time_left -= deltat;
589  if(auxp->time_left > 0)
590  {
591  if(auxp->time_left < min_time)
592  {
593  min_time = auxp->time_left;
594  }
595  }
596  else
597  {
598  if(auxp->time < min_time)
599  {
600  min_time = auxp->time;
601  }
602  }
603  if((!deltat) && (min_time <= 1))
604  break;
605  }
606  }
607  }
608  if(min_time == 100000)
609  min_time = 0;
610  return min_time;
611 }
Definition: dim.h:370
#define SPECIAL_QUEUE
Definition: dtq.c:32
#define WRITE_QUEUE
Definition: dtq.c:33
static QUEUE_ENT timer_queues[MAX_TIMER_QUEUES+2]
Definition: dtq.c:54
TIMR_ENT * queue_head
Definition: dtq.c:49
Definition: dim.h:530
int time_left
Definition: dim.h:375
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
int time
Definition: dim.h:374
static int queue_id
Definition: tcpip.c:93
#define MAX_TIMER_QUEUES
Definition: dtq.c:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function: