IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6236


Ignore:
Timestamp:
Jan 29, 2006, 8:56:11 AM (20 years ago)
Author:
eugene
Message:

moved image lock/unlock to libdvo, fixed up skydb interactions

Location:
trunk/Ohana/src/addstar/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r5945 r6236  
    33int UpdateDatabase_Image (AddstarClientOptions *options, Image *image, Coords *mosaic, Stars *stars, int Nstars) {
    44
    5   int i, Noverlap;
     5  int i, Noverlap, status;
    66  Image *overlap;
    77  Catalog catalog;
     
    3232
    3333    set_db (&db);
    34 
    35     /* XXX EAM : this should be SOFT, not XCLD */
    36     lock_image_db (&db, ImageCat);
     34    status = dvo_image_lock (&db, ImageCat, 60.0, LCK_SOFT);
     35    if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    3736
    3837    /* load images / build overlap : XXX EAM : split into two functions? */
    3938    overlap = gimages (&db, image, mosaic, &Noverlap);
    40     unlock_image_db (&db);
     39    dvo_image_unlock (&db);
    4140  }
    4241
     
    5049  if (options[0].only_match || options[0].existing_regions) {
    5150    SkyList *tmp;
    52     tmp = SkyListExistingSubset (skylist);
     51    tmp = SkyListExistingSubset (skylist, CATDIR);
    5352    SkyListFree (skylist, FALSE);
    5453    skylist = tmp;
     
    8786    set_db (&db);
    8887
    89     lock_image_db (&db, ImageCat);
     88    status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD);
     89    if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    9090
    91     /* load images / build overlap : XXX EAM : split into two functions */
     91    /* load images / build overlap : XXX EAM : split into two functions? */
    9292    overlap = gimages (&db, image, mosaic, &Noverlap);
    9393
    94     if (db.dbstate == LCK_EMPTY) {
    95       create_image_db (&db);
    96     }
     94    if (db.dbstate == LCK_EMPTY) create_image_db (&db);
    9795 
    9896    /* write out new image */
     
    10199    dvo_image_update (&db, VERBOSE);
    102100    SetProtect (FALSE);
    103     unlock_image_db (&db);
     101    dvo_image_unlock (&db);
    104102  }
    105103  return (TRUE);
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Refcat.c

    r5945 r6236  
    4444  if (options[0].only_match || options[0].existing_regions) {
    4545    SkyList *tmp;
    46     tmp = SkyListExistingSubset (skylist);
     46    tmp = SkyListExistingSubset (skylist, CATDIR);
    4747    SkyListFree (skylist, FALSE);
    4848    skylist = tmp;
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Reflist.c

    r5945 r6236  
    4646
    4747  /* reduce regions to existing subset, if necessary */
    48   SkyListSetPath (skylist, CATDIR);
     48  SkyListSetFilenames (skylist, CATDIR, "cpt");
    4949  if (options[0].only_match || options[0].existing_regions) {
    5050    SkyList *tmp;
    51     tmp = SkyListExistingSubset (skylist);
     51    tmp = SkyListExistingSubset (skylist, CATDIR);
    5252    SkyListFree (skylist, FALSE);
    5353    skylist = tmp;
  • trunk/Ohana/src/addstar/src/addstar.c

    r5945 r6236  
    33int main (int argc, char **argv) {
    44
    5   int Nm, Na, Ns;
     5  int Nm, Na, Ns, status;
    66  int i, Nstars, Noverlap, Nsubset, Naverage, Nmeasure;
    77  Stars *stars, **subset;
     
    3535  }
    3636
    37   /* we use the image table to lock db access -- perhaps this is not necessary?*/
    38   lock_image_db (&db, ImageCat);
     37  /* we use the image table to lock db access -- perhaps this is not necessary? */
     38  status = dvo_image_lock (&db, ImageCat, 3600.0, LCK_XCLD);
     39  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    3940  gettimeofday (&stop, NULL);
    4041  dtime = DTIME (stop, start);
    41   fprintf (stderr, "mark: lock_image_db: time %9.4f sec\n", dtime);
    4242
    4343  switch (options.mode) {
     
    8080    if ((catalog.Nave_disk == 0) && options.only_match) {
    8181      unlock_catalog (&catalog);
    82       free (catalog.filename);
    8382      continue;
    8483    }
     
    157156  }
    158157  ohana_memcheck (FALSE);
    159   /* unlock_image_db (&db); */
     158  dvo_image_unlock (&db); /* unlock? */
    160159
    161160  gettimeofday (&stop, NULL);
  • trunk/Ohana/src/addstar/src/addstard.c

    r5448 r6236  
    1313  /* store the sky table in a global for internal use */
    1414  ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);
    15   SkyTableSetFilename (ServerSky, CATDIR, "cpt");
     15  SkyTableSetFilenames (ServerSky, CATDIR, "cpt");
    1616
    1717  /* if we separate the incoming data from db update, spawn db thread here */
  • trunk/Ohana/src/addstar/src/image-db.c

    r5229 r6236  
    11# include "addstar.h"
    2 
    3 void lock_image_db (FITS_DB *db, char *filename) {
    4 
    5   /* lock the image catalog */
    6   check_permissions (filename);
    7 
    8   db[0].lockstate = LCK_XCLD;
    9   db[0].timeout   = 3600.0;
    10   fits_db_init (db);
    11 
    12   if (!fits_db_lock (db, filename)) {
    13     fprintf (stderr, "ERROR: can't lock image catalog\n");
    14     exit (1);
    15   }
    16 }
    17 
    18 void unlock_image_db (FITS_DB *db) {
    19 
    20   mode_t mode;
    21 
    22   fprintf (stderr, "closing file\n");
    23   if (db[0].f == NULL) {
    24     fprintf (stderr, "re-closing file??\n");
    25   }
    26   fits_db_close (db);
    27   db[0].f = NULL;
    28 
    29   /* force permissions to 666 */
    30   mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
    31   chmod (db[0].filename, mode);
    32 }
    332
    343void create_image_db (FITS_DB *db) {
Note: See TracChangeset for help on using the changeset viewer.