Пример #1
0
/*-----------------------------------------------*/ void newclock(void *tag) {
/* this thread started with 2 events( only 1 available in one time):
- clock change
- DLL_RESYNC
*/
printf("newclock thread started. clocktran:%d tag:%d quit:%d\n", 
  clocktran, *(int *)tag, quit); fflush(stdout);
while(clocktran>=0) {
  int nclients;
  nclients= dis_update_service(MICLOCK_TRANSITIONid);
  printf("updated MICLOCK_TRANSITION clients:%d clocktran:%d\n", nclients, clocktran);
  if(clocktran==0) break;
  dtq_sleep(SLOT_S);
  clocktran--; sprintf(clocktransition,"%d", clocktran);
  if(clocktran==0) {
    if(*(int *)tag==0) {
      /*int rc;
      char cmd[]="$VMECFDIR/ttcmidaemons/sctel.py MININF";
      DLL_RESYNC(DLL_info); // commented 19092014
      //printf("DLL_RESYNC + clearing the scope persistance\n");
      rc= system(cmd);   commented 19092014
      printf("DLL_RESYNC + MININF not done!\n"); */
      DLL_RESYNC(DLL_info);
    } else {
      setbcorbit(*(int *)tag); 
      nclients= dis_update_service(MICLOCKid);
      printf("updated MICLOCK clients:%d\n", nclients);
    };
  };
  if(quit==1) clocktran=0;
};
}
Пример #2
0
/*-----------------------------------------------*/ void newclock(void *tag) {
/* this thread started with 2 events( only 1 available in one time):
- clock change
- DLL_RESYNC
*/
rcnewclock= 888;
newclockstarts++;
printf("newclock thread started. clocktran:%d tag:%d quit:%d\n", 
  clocktran, *(int *)tag, quit); fflush(stdout);
while(clocktran>=0) {
  int nclients;
  nclients= dis_update_service(MICLOCK_TRANSITIONid);
  printf("updated MICLOCK_TRANSITION clients:%d clocktran:%d\n", nclients, clocktran);
  if(clocktran==0) break;
  dtq_sleep(SLOT_S);
  clocktran--; sprintf(clocktransition,"%d", clocktran);
  if(clocktran==0) {
    if(*(int *)tag==0) {
      /*int rc;
      char cmd[]="$VMECFDIR/ttcmidaemons/sctel.py MININF";
      DLL_RESYNC(DLL_info); // commented 19092014
      //printf("DLL_RESYNC + clearing the scope persistance\n");
      rc= system(cmd);   commented 19092014
      printf("DLL_RESYNC + MININF not done!\n"); */
      DLL_RESYNC(DLL_info);
    } else {
#define reslen 3200
      int rc; char server[24]; char cmd[80]; char result[reslen];
      if(envcmp("VMESITE", "ALICE")==0) {
        strcpy(server, getenv("SERVER_NODE"));
      } else {
        strcpy(server, "adls");
      };
      infolog_trgboth(LOG_WARNING, "ALICE clock changed, restaring ctpproxy (25s)...");
      sprintf(cmd, "ssh trigger@%s ctpproxy.py restart nomasks", server);
      setbcorbit(*(int *)tag); 
      nclients= dis_update_service(MICLOCKid);
      printf("updated MICLOCK clients:%d\n", nclients);
      //printf("updated MICLOCK clients:%d, now ctpproxy.py restart nomasks...\n", nclients);
      rc= popenread(cmd, result, reslen);
      if(rc==EXIT_FAILURE) { 
        printf("ERROR cmd:%s rc:%d\n", cmd, rc);
      } else {
        printf("result(len:%d):%s\n", strlen(result), result);
      };  
    };
  };
  if(quit==1) clocktran=0;
}; clocktran_s=0;
rcnewclock= 0;
}