Ejemplo n.º 1
0
void startThread() {
dim_start_thread(calthread, (void *)&TAGcalthread);
usleep(100000);
if(threadactive==0) {
  char msg[200];
  sprintf(msg,"thread not started! exiting..."); prtLog(msg);
  //exit(8);
  quit=8;
};
/*
if(detectfile("gcalrestart", 0) >=0) {   //debug: simulate error by file presence
  // i.e.: echo blabla >$VMEWORKDIR/gcalrestart
  char msg[200];
  //system("gcalibrestart_at.sh >/tmp/gcalibresatrt_at.log");
  system("rm gcalrestart");
  sprintf(msg,"gcalrestart removed, registered, exiting..."); prtLog(msg);
  //exit(8);
  quit=8; 
}else {
  char msg[200];
  //system("gcalibrestart_at.sh");
  sprintf(msg,"WORK/../gcalrestart not present (i.e. real crash, not simulated)"); prtLog(msg);
};
*/
}
Ejemplo n.º 2
0
/*-----------------*/ void checkstartthread(int clocktag) {
char errmsg[200];
if(clocktran!=0)  {
  /* run1 way:
  sprintf(errmsg, "MICLOCK_SET: newclock thread already started! exiting..."); prtLog(errmsg); 
  quit=1;   // better quit, and restart (monitor.py should be active !)
   * run2: 
  - ignore a command setting new clock, if pevious one no finished yet 
  - restart myself if stucked too long in thread */
  if(clocktran_s!=0) {          
    w32 diff_s, diff_u;
    DiffSecUsecFrom(clocktran_s, clocktran_u, &diff_s, &diff_u);
    if(diff_s > (w32) (SLOT_S*5)) {
      sprintf(errmsg, "newclock thread stucked (%d secs). Trigger expert should restart ttcmidim and miclock client!", diff_s); prtLog(errmsg); 
      infolog_trgboth(LOG_FATAL, errmsg);
    } else {
      sprintf(errmsg, "checkstartthread tag:%d: newclock thread already started %d secs, cmd ignored...",
        clocktag, diff_s); prtLog(errmsg); 
    };
    return;  
  };
};
clocktran=3; strcpy(clocktransition,"3"); GetMicSec(&clocktran_s, &clocktran_u);
newclocktag= clocktag;
sprintf(errmsg, "newclock thread starting. tag:%d \n", newclocktag); prtLog(errmsg); 
dim_start_thread(newclock, (void *)&newclocktag);
}