IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 4, 2008, 4:29:47 PM (18 years ago)
Author:
eugene
Message:

add interrupts to (potentially) long loops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/paverage.c

    r19823 r20535  
    66  FILE *f;
    77  int i, j, kapa, Narg, Npts, NPTS, status, VERBOSE;
    8   int Nsecfilt, Nsec;
     8  int Nsecfilt, Nsec, Nloaded;
    99  double Mz, Mr, mag;
    1010  double Radius, Rmin, Rmax, R, D;
    1111  unsigned IDclip, IDchoice, LimExclude;
    1212  float *Xvec, *Yvec, *Zvec;
     13  void *Signal;
    1314
    1415  PhotCode *photcode;
     
    99100  ALLOCATE (Zvec, float, NPTS);
    100101
    101   for (j = 0; j < skylist[0].Nregions; j++) {
     102  // prepare to handle interrupt signals
     103  Signal = signal (SIGINT, handle_interrupt);
     104  interrupt = FALSE;
     105
     106  Nloaded = 0;
     107  for (j = 0; (j < skylist[0].Nregions) && !interrupt; j++) {
    102108    catalog.filename = skylist[0].filename[j];
    103109    catalog.catflags = LOAD_AVES | LOAD_SECF;
     
    115121
    116122    /* project stars to screen display coords */
    117     for (i = 0; i < catalog.Naverage; i++) {
     123    for (i = 0; (i < catalog.Naverage) && !interrupt; i++) {
    118124      if (IDclip && (average[i].code != IDchoice)) continue;
    119125      average[i].R = ohana_normalize_angle (average[i].R);
     
    128134      D = average[i].D;
    129135      status = fRD_to_XY (&Xvec[Npts], &Yvec[Npts], R, D, &graphmode.coords);
    130       if (!status) {
    131           fprintf (stderr, ".");
    132           continue;
    133       }
     136      if (!status) continue;
    134137      Npts ++;
    135138
     
    140143          REALLOCATE (Zvec, float, NPTS);
    141144      }
    142       if (Npts > NCHUNK) {
     145      if ((Npts > NCHUNK) || (Nloaded >= 25)) {
    143146          PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode);
    144147          Npts = 0;
     148          Nloaded = 0;
    145149      }
    146150    }
     151    Nloaded ++;
    147152    dvo_catalog_free (&catalog);
    148153  }
Note: See TracChangeset for help on using the changeset viewer.