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/pmeasure.c

    r19823 r20535  
    77 
    88  FILE *f;
    9   int i, j, k, m, kapa, Narg, Npts, NPTS, status, VERBOSE, TimeSelect;
     9  int i, j, k, m, kapa, Narg, Npts, NPTS, status, VERBOSE, TimeSelect, Nloaded;
    1010  double Mz, Mr, mag;
    1111  double Radius, Rmin, Rmax, R, D, trange;
     
    1616  float *Xvec, *Yvec, *Zvec;
    1717  time_t tzero, tend;
     18  void *Signal;
    1819
    1920  SkyTable *sky;
     
    172173  ALLOCATE (Zvec, float, NPTS);
    173174
    174   for (j = 0; j < skylist[0].Nregions; j++) {
     175  // prepare to handle interrupt signals
     176  Signal = signal (SIGINT, handle_interrupt);
     177  interrupt = FALSE;
     178
     179  Nloaded = 0;
     180  for (j = 0; (j < skylist[0].Nregions) && !interrupt; j++) {
    175181    catalog.filename = skylist[0].filename[j];
    176182    catalog.catflags = LOAD_AVES | LOAD_MEAS;
     
    185191
    186192    /* project stars to screen display coords */
    187     for (i = 0; i < catalog.Naverage; i++) {
     193    for (i = 0; (i < catalog.Naverage) && !interrupt; i++) {
    188194      if (IDclip && (catalog.average[i].code != IDchoice)) continue;
    189195      catalog.average[i].R = ohana_normalize_angle (catalog.average[i].R);
     
    213219        }
    214220        status = fRD_to_XY (&Xvec[Npts], &Yvec[Npts], R, D, &graphmode.coords);
    215         if (!status) {
    216           fprintf (stderr, ".");
    217           continue;
    218         }
     221        if (!status) continue;
    219222        Npts ++;
    220223
     
    225228            REALLOCATE (Zvec, float, NPTS);
    226229        }
    227         if (Npts > NCHUNK) {
     230        if ((Npts > NCHUNK) || (Nloaded >= 25)) {
    228231            PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode);
    229232            Npts = 0;
     233            Nloaded = 0;
    230234        }
    231235      }
    232236    }
     237    Nloaded ++;
    233238    dvo_catalog_free (&catalog);
    234239  }
Note: See TracChangeset for help on using the changeset viewer.