FACT++  1.0
static int scan_it ( )
static

Definition at line 661 of file dtq.c.

References dll_get_next(), dll_remove(), Memory::free(), i, MAX_TIMER_QUEUES, QUEUE_ENT::queue_head, queue_id, rem_deleted_entries(), QUEUE_ENT::remove_entries, SPECIAL_QUEUE, timer_entry::tag, timer_entry::time, timer_entry::time_left, timer_entry::user_routine, and WRITE_QUEUE.

Referenced by alrm_sig_handler(), and dim_dtq_stop().

662 {
663  int queue_id, i, n = 0;
664  static int curr_queue_id = 0;
665  static TIMR_ENT *curr_entry = 0;
666  TIMR_ENT *auxp, *prevp, *queue_head;
667  TIMR_ENT *done[1024];
668 
669  DISABLE_AST
670  queue_head = timer_queues[WRITE_QUEUE].queue_head;
671  if(!queue_head)
672  {
673  ENABLE_AST
674  return(0);
675  }
676  auxp = queue_head;
677  while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
678  {
679  done[n++] = auxp;
680  if(n == 1000)
681  break;
682  }
683  ENABLE_AST
684  for(i = 0; i < n; i++)
685  {
686  auxp = done[i];
687  auxp->user_routine( auxp->tag );
688  }
689  {
690  DISABLE_AST
691  for(i = 0; i < n; i++)
692  {
693  auxp = done[i];
694  dll_remove(auxp);
695  free(auxp);
696  }
697  if(n == 1000)
698  {
699  ENABLE_AST
700  return(1);
701  }
702  ENABLE_AST
703  }
704  {
705  DISABLE_AST
706  queue_head = timer_queues[SPECIAL_QUEUE].queue_head;
707  auxp = queue_head;
708  prevp = auxp;
709  while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
710  {
711  if(auxp->time_left <= 0)
712  {
713  dll_remove(auxp);
714  auxp->user_routine( auxp->tag );
715  free(auxp);
716  auxp = prevp;
717  n++;
718  if(n == 100)
719  {
720  ENABLE_AST
721  return(1);
722  }
723  }
724  else
725  prevp = auxp;
726  }
727  for( queue_id = curr_queue_id; queue_id < MAX_TIMER_QUEUES; queue_id++ )
728  {
729  if( (queue_head = timer_queues[queue_id].queue_head) == NULL )
730  continue;
731  Inside_ast = 1;
732  if((curr_entry) && (queue_id == curr_queue_id))
733  auxp = curr_entry;
734  else
735  auxp = queue_head;
736  while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
737  {
738  if(auxp->time_left <= 0)
739  {
740  auxp->user_routine( auxp->tag );
741  auxp->time_left = auxp->time; /*restart clock*/
742  n++;
743  if(n == 100)
744  {
745  curr_queue_id = queue_id;
746  curr_entry = auxp;
747  ENABLE_AST
748  return(1);
749  }
750  }
751  }
752  Inside_ast = 0;
753  if( timer_queues[queue_id].remove_entries ) {
754  rem_deleted_entries( queue_id );
756  }
757  }
758  curr_queue_id = 0;
759  curr_entry = 0;
760  ENABLE_AST
761  }
762  return(0);
763 }
dim_long tag
Definition: dim.h:377
int i
Definition: db_dim_client.c:21
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
void dll_remove(DLL *item)
Definition: dll.c:100
static int Inside_ast
Definition: dtq.c:59
static int rem_deleted_entries(int queue_id)
Definition: dtq.c:524
TIMR_ENT * queue_head
Definition: dtq.c:49
Definition: dim.h:530
int time_left
Definition: dim.h:375
int remove_entries
Definition: dtq.c:50
void free(void *mem)
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
void(* user_routine)()
Definition: dim.h:376

+ Here is the call graph for this function:

+ Here is the caller graph for this function: