IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6238


Ignore:
Timestamp:
Jan 29, 2006, 9:09:54 AM (20 years ago)
Author:
eugene
Message:

moved image lock/unlock to libdvo

Location:
trunk/Ohana/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/photdbc/src/image-db.c

    r4864 r6238  
    11# include "photdbc.h"
    22
    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   fits_db_close (db);
    23 
    24   /* force permissions to 666 */
    25   mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
    26   chmod (db[0].filename, mode);
    27 }
  • trunk/Ohana/src/photdbc/src/load_images.c

    r4864 r6238  
    1111  region = name_region (seed, &Nregion);
    1212
    13   if (db[0].dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db[0].filename);
    14 
    1513  /* read entire db table */
    1614  if (!dvo_image_load (db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db[0].filename);
  • trunk/Ohana/src/photdbc/src/photdbc.c

    r4864 r6238  
    33int main (int argc, char **argv) {
    44
    5   int Nregion;
     5  int Nregion, status;
    66  char filename[1024];
    77  Catalog *catalog;
     
    1313
    1414  set_db (&db);
    15   lock_image_db (&db, ImageCat);
     15  status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD); /* XCLD */
     16  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
     17  if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename);
    1618
    1719  /* load region and images overlapping region */
  • trunk/Ohana/src/uniphot/src/image-db.c

    r4864 r6238  
    11# include "uniphot.h"
    22
    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   fits_db_close (db);
    23 
    24   /* force permissions to 666 */
    25   mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
    26   chmod (db[0].filename, mode);
    27 }
  • trunk/Ohana/src/uniphot/src/load_images.c

    r4864 r6238  
    55  if (VERBOSE) fprintf (stderr, "finding images\n");
    66
    7   if (db[0].dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db[0].filename);
    8 
    97  /* read entire db table */
    108  if (!dvo_image_load (db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db[0].filename);
  • trunk/Ohana/src/uniphot/src/uniphot.c

    r5386 r6238  
    33int main (int argc, char **argv) {
    44
    5   int i, Ntgroup, Nsgroup;
     5  int i, Ntgroup, Nsgroup, status;
    66  Group *tgroup, *sgroup;
    77  ImageLink *imlinks;
     
    1212
    1313  set_db (&db);
    14   lock_image_db (&db, ImageCat);
     14  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
     15  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
     16  if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename);
     17  if (!UPDATE) dvo_image_unlock (&db);
    1518
    1619  /* load images */
     
    4649             sgroup[i].Nimage, sgroup[i].Ngood, 0.001*sgroup[i].M, 0.001*sgroup[i].dM, 0.001*sgroup[i].dMsub);
    4750  }
    48 
    4951  if (!UPDATE) exit (0);
    5052
    5153  update (&db, sgroup, Nsgroup);
    52   unlock_image_db (&db);
     54  dvo_image_unlock (&db);
    5355
    5456  exit (0);
Note: See TracChangeset for help on using the changeset viewer.