Changeset 6236
- Timestamp:
- Jan 29, 2006, 8:56:11 AM (20 years ago)
- Location:
- trunk/Ohana/src/addstar/src
- Files:
-
- 6 edited
-
UpdateDatabase_Image.c (modified) (5 diffs)
-
UpdateDatabase_Refcat.c (modified) (1 diff)
-
UpdateDatabase_Reflist.c (modified) (1 diff)
-
addstar.c (modified) (4 diffs)
-
addstard.c (modified) (1 diff)
-
image-db.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c
r5945 r6236 3 3 int UpdateDatabase_Image (AddstarClientOptions *options, Image *image, Coords *mosaic, Stars *stars, int Nstars) { 4 4 5 int i, Noverlap ;5 int i, Noverlap, status; 6 6 Image *overlap; 7 7 Catalog catalog; … … 32 32 33 33 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); 37 36 38 37 /* load images / build overlap : XXX EAM : split into two functions? */ 39 38 overlap = gimages (&db, image, mosaic, &Noverlap); 40 unlock_image_db(&db);39 dvo_image_unlock (&db); 41 40 } 42 41 … … 50 49 if (options[0].only_match || options[0].existing_regions) { 51 50 SkyList *tmp; 52 tmp = SkyListExistingSubset (skylist );51 tmp = SkyListExistingSubset (skylist, CATDIR); 53 52 SkyListFree (skylist, FALSE); 54 53 skylist = tmp; … … 87 86 set_db (&db); 88 87 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); 90 90 91 /* load images / build overlap : XXX EAM : split into two functions */91 /* load images / build overlap : XXX EAM : split into two functions? */ 92 92 overlap = gimages (&db, image, mosaic, &Noverlap); 93 93 94 if (db.dbstate == LCK_EMPTY) { 95 create_image_db (&db); 96 } 94 if (db.dbstate == LCK_EMPTY) create_image_db (&db); 97 95 98 96 /* write out new image */ … … 101 99 dvo_image_update (&db, VERBOSE); 102 100 SetProtect (FALSE); 103 unlock_image_db(&db);101 dvo_image_unlock (&db); 104 102 } 105 103 return (TRUE); -
trunk/Ohana/src/addstar/src/UpdateDatabase_Refcat.c
r5945 r6236 44 44 if (options[0].only_match || options[0].existing_regions) { 45 45 SkyList *tmp; 46 tmp = SkyListExistingSubset (skylist );46 tmp = SkyListExistingSubset (skylist, CATDIR); 47 47 SkyListFree (skylist, FALSE); 48 48 skylist = tmp; -
trunk/Ohana/src/addstar/src/UpdateDatabase_Reflist.c
r5945 r6236 46 46 47 47 /* reduce regions to existing subset, if necessary */ 48 SkyListSet Path (skylist, CATDIR);48 SkyListSetFilenames (skylist, CATDIR, "cpt"); 49 49 if (options[0].only_match || options[0].existing_regions) { 50 50 SkyList *tmp; 51 tmp = SkyListExistingSubset (skylist );51 tmp = SkyListExistingSubset (skylist, CATDIR); 52 52 SkyListFree (skylist, FALSE); 53 53 skylist = tmp; -
trunk/Ohana/src/addstar/src/addstar.c
r5945 r6236 3 3 int main (int argc, char **argv) { 4 4 5 int Nm, Na, Ns ;5 int Nm, Na, Ns, status; 6 6 int i, Nstars, Noverlap, Nsubset, Naverage, Nmeasure; 7 7 Stars *stars, **subset; … … 35 35 } 36 36 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); 39 40 gettimeofday (&stop, NULL); 40 41 dtime = DTIME (stop, start); 41 fprintf (stderr, "mark: lock_image_db: time %9.4f sec\n", dtime);42 42 43 43 switch (options.mode) { … … 80 80 if ((catalog.Nave_disk == 0) && options.only_match) { 81 81 unlock_catalog (&catalog); 82 free (catalog.filename);83 82 continue; 84 83 } … … 157 156 } 158 157 ohana_memcheck (FALSE); 159 /* unlock_image_db (&db);*/158 dvo_image_unlock (&db); /* unlock? */ 160 159 161 160 gettimeofday (&stop, NULL); -
trunk/Ohana/src/addstar/src/addstard.c
r5448 r6236 13 13 /* store the sky table in a global for internal use */ 14 14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE); 15 SkyTableSetFilename (ServerSky, CATDIR, "cpt");15 SkyTableSetFilenames (ServerSky, CATDIR, "cpt"); 16 16 17 17 /* if we separate the incoming data from db update, spawn db thread here */ -
trunk/Ohana/src/addstar/src/image-db.c
r5229 r6236 1 1 # 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 }33 2 34 3 void create_image_db (FITS_DB *db) {
Note:
See TracChangeset
for help on using the changeset viewer.
