IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37677


Ignore:
Timestamp:
Nov 26, 2014, 7:46:26 AM (12 years ago)
Author:
eugene
Message:

lock threads before updating offset map table

Location:
branches/eam_branches/ipp-20140904/Ohana/src/relastro
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/include/relastro.h

    r37665 r37677  
    655655
    656656int HarvestRegionHosts (RegionHostTable *regionHosts);
     657
     658void lockUpdateChips ();
     659void unlockUpdateChips ();
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FitChip.c

    r37646 r37677  
    115115      if (image[0].coords.offsetMap == NULL) {
    116116        // allocate a new table and assign to this image
     117        // need to lock threads here because 'table' is a static with
     118        // modifiable elements
     119        lockUpdateChips ();
    117120        AstromOffsetTable *table = get_astrom_table ();
    118121        AstromOffsetTableNewMap(table, order_use, image);
     122        unlockUpdateChips ();
    119123      }
    120124      fit_map (image[0].coords.offsetMap, raw, ref, Nmatch);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateChips.c

    r37649 r37677  
    354354static pthread_mutex_t UpdateChips_mutex = PTHREAD_MUTEX_INITIALIZER;
    355355
     356void lockUpdateChips () {
     357  pthread_mutex_lock (&UpdateChips_mutex);
     358}
     359void unlockUpdateChips () {
     360  pthread_mutex_unlock (&UpdateChips_mutex);
     361}
     362
    356363// we have an array of chips (image, Nimage).  we need to hand out images one at a time to
    357364// the worker threads as they need
    358365off_t getNextImageForThread () {
    359366
    360   pthread_mutex_lock (&UpdateChips_mutex);
     367  lockUpdateChips ();
    361368  if (nextImage >= Nimage) {
    362     pthread_mutex_unlock (&UpdateChips_mutex);
     369    unlockUpdateChips ();
    363370    return (-1);
    364371  }
     
    366373  nextImage ++;
    367374
    368   pthread_mutex_unlock (&UpdateChips_mutex);
     375  unlockUpdateChips ();
    369376  return (thisImage);
    370377}
Note: See TracChangeset for help on using the changeset viewer.