FACT++  1.0
int dim_dtq_init ( int  thr_flag)

Definition at line 91 of file dtq.c.

References alrm_sig_handler(), dll_init(), dummy_alrm_sig_handler(), Memory::malloc(), QUEUE_ENT::queue_head, SPECIAL_QUEUE, and WRITE_QUEUE.

Referenced by dim_dtq_thread(), dtq_create(), dtq_start_timer(), and dummy_alrm_sig_handler().

92 {
93 struct sigaction sig_info;
94 sigset_t set;
95 int ret = 0;
96 
97 /*
98  pid = getpid();
99 */
100  if( !sigvec_done)
101  {
102  Inside_ast = 0;
103  Alarm_runs = 0;
104  DIM_last_time = 0;
105 /*
106  for(i = 0; i < MAX_TIMER_QUEUES + 2; i++)
107  {
108  timer_queues[i].queue_head = 0;
109  timer_queues[i].remove_entries = 0;
110  }
111 */
112  if( timer_queues[SPECIAL_QUEUE].queue_head == NULL ) {
114  memset(timer_queues[SPECIAL_QUEUE].queue_head, 0, sizeof(TIMR_ENT));
115  dll_init( (DLL *)timer_queues[SPECIAL_QUEUE].queue_head);
116  }
117  if( timer_queues[WRITE_QUEUE].queue_head == NULL ) {
119  memset(timer_queues[WRITE_QUEUE].queue_head, 0, sizeof(TIMR_ENT));
120  dll_init( (DLL *)timer_queues[WRITE_QUEUE].queue_head);
121  }
122  if(!thr_flag)
123  {
124  Threads_off = 1;
125  }
126  sigemptyset(&set);
127 
128  sigaddset(&set,SIGIO);
129 
130  if(thr_flag)
131  sig_info.sa_handler = dummy_alrm_sig_handler;
132  else
133  sig_info.sa_handler = alrm_sig_handler;
134  sig_info.sa_mask = set;
135 #ifndef LYNXOS
136  sig_info.sa_flags = SA_RESTART;
137 #else
138  sig_info.sa_flags = 0;
139 #endif
140  if( sigaction(SIGALRM, &sig_info, 0) < 0 ) {
141  perror( "sigaction(SIGALRM)" );
142  exit(1);
143  }
144 
145  sigvec_done = 1;
146  ret = 1;
147  }
148  return(ret);
149 }
static time_t DIM_last_time
Definition: dtq.c:67
void * malloc()
Definition: EventBuilder.cc:99
Definition: dim.h:370
#define SPECIAL_QUEUE
Definition: dtq.c:32
void dll_init(DLL *head)
Definition: dll.c:14
#define WRITE_QUEUE
Definition: dtq.c:33
static int Alarm_runs
Definition: dtq.c:60
static QUEUE_ENT timer_queues[MAX_TIMER_QUEUES+2]
Definition: dtq.c:54
static int Inside_ast
Definition: dtq.c:59
TIMR_ENT * queue_head
Definition: dtq.c:49
Definition: dim.h:530
static int Threads_off
Definition: dtq.c:71
static int sigvec_done
Definition: dtq.c:61
void dummy_alrm_sig_handler(int num)
Definition: dtq.c:151
static void alrm_sig_handler(int num)
Definition: dtq.c:765

+ Here is the call graph for this function:

+ Here is the caller graph for this function: