IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21431


Ignore:
Timestamp:
Feb 10, 2009, 10:58:17 AM (17 years ago)
Author:
bills
Message:

when waiting for fits file's directory to be accessible, only double wait
time until it's about 5 seconds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFits.c

    r21117 r21431  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2009-01-13 21:04:28 $
     9 *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2009-02-10 20:58:17 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737#define MAX_STRING_LENGTH 256           // Maximum length string for FITS routines
    3838
    39 #define FITS_OPEN_RETRIES 50            // Number of retries to attempt when opening a FITS file
    40 #define FITS_OPEN_RETRY_WAIT 200000     // Wait between retries (usec)
     39#define FITS_OPEN_RETRIES 16            // Number of retries to attempt when opening a FITS file
     40#define FITS_OPEN_RETRY_WAIT_MIN 200000 // Wait between retries (usec) first time
     41#define FITS_OPEN_RETRY_WAIT_MAX 5000000 // double wait time up to 5 sec
    4142
    4243static char *defaultExtword = "EXTNAME";
     
    141142    psString tmpname = psStringCopy(name); // Copy of filename, since dirname() may modify
    142143    const char *dir = dirname(tmpname); // Directory for file
    143     useconds_t waittime = FITS_OPEN_RETRY_WAIT; // Wait time between retries (usec)
     144    useconds_t waittime = FITS_OPEN_RETRY_WAIT_MIN; // Wait time between retries (usec)
    144145
    145146    for (int i = 0; (i < FITS_OPEN_RETRIES) && ((dirstat = access(dir, F_OK)) != 0); i++) {
     
    162163
    163164        usleep(waittime);
    164         waittime *= 2;
     165        // double waittime until we get to the max value
     166        if (waittime < FITS_OPEN_RETRY_WAIT_MAX) {
     167            waittime *= 2;
     168        }
    165169    }
    166170    if (dirstat != 0) {
Note: See TracChangeset for help on using the changeset viewer.