FACT++  1.0
void dim_init ( )

Definition at line 111 of file dim_thr.c.

References dim_dtq_thread(), DIM_INIT_Sema, dim_no_threads(), dim_tcpip_thread(), DIM_THR_init_done, DIM_Threads_OFF, dna_init(), ignore_sigpipe(), INIT_count, INIT_thread, and MAIN_thread.

Referenced by did_init(), dim_init_threads(), dim_signal_cond(), dis_init(), DimInfo::doIt(), DimStampedInfo::doIt(), DimUpdatedInfo::doIt(), fork_em(), Parent::fork_em(), main(), and DimRpcInfo::subscribe().

112 {
113  pthread_t t_id;
114  void ignore_sigpipe();
115  extern int dna_init();
116 /*
117 #ifdef LYNXOS
118 */
119  pthread_attr_t attr;
120 /*
121 #endif
122 */
123  if(DIM_Threads_OFF)
124  {
125  dim_no_threads();
126  return;
127  }
128  if(!DIM_THR_init_done)
129  {
130  /*
131  int prio;
132  */
133  DIM_THR_init_done = 1;
134  dna_init();
135  /*
136  thr_getprio(thr_self(),&prio);
137  thr_setprio(thr_self(),prio+3);
138  */
139  INIT_thread = pthread_self();
141 
142 #ifndef darwin
143  sem_init(&DIM_INIT_Sema, 0, (unsigned int)INIT_count);
144  /*
145  sem_init(&DIM_WAIT_Sema, 0, WAIT_count);
146  */
147 #else
148  DIM_INIT_Semap = sem_open("/Dim_INIT_Sem", O_CREAT, S_IRUSR | S_IWUSR, INIT_count);
149  /*
150  DIM_WAIT_Semap = sem_open("/Dim_WAIT_Sem", O_CREAT, S_IRUSR | S_IWUSR, WAIT_count);
151  */
152 #endif
153 
154  ignore_sigpipe();
155 
156 #if defined (LYNXOS) && !defined (__Lynx__)
157  pthread_attr_create(&attr);
158  pthread_create(&t_id, attr, dim_dtq_thread, 0);
159 #else
160 /*
161  pthread_create(&t_id, NULL, dim_dtq_thread, 0);
162 */
163  pthread_attr_init(&attr);
164  pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
165  pthread_create(&t_id, &attr, dim_dtq_thread, 0);
166 #endif
167 #ifndef darwin
168  sem_wait(&DIM_INIT_Sema);
169 #else
170  sem_wait(DIM_INIT_Semap);
171 #endif
172 #if defined (LYNXOS) && !defined (__Lynx__)
173  pthread_create(&t_id, attr, dim_tcpip_thread, 0);
174 #else
175  pthread_create(&t_id, &attr, dim_tcpip_thread, 0);
176 #endif
177 #ifndef darwin
178  sem_wait(&DIM_INIT_Sema);
179 #else
180  sem_wait(DIM_INIT_Semap);
181 #endif
182  INIT_thread = 0;
183  }
184 }
void * dim_tcpip_thread(void *tag)
Definition: dim_thr.c:39
pthread_t INIT_thread
Definition: dim_thr.c:20
int DIM_THR_init_done
Definition: dim_thr.c:37
void * dim_dtq_thread(void *tag)
Definition: dim_thr.c:75
pthread_t MAIN_thread
Definition: dim_thr.c:21
void dim_no_threads()
Definition: dtq.c:80
sem_t DIM_INIT_Sema
Definition: dim_thr.c:23
int DIM_Threads_OFF
Definition: dtq.c:14
int dna_init()
Definition: dna.c:530
int INIT_count
Definition: dim_thr.c:33
void ignore_sigpipe()
Definition: dim_thr.c:356

+ Here is the call graph for this function:

+ Here is the caller graph for this function: