IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 3:05:58 PM (18 years ago)
Author:
eugene
Message:

added mutexes to protect the psImage children management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.c

    r20547 r21347  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.132 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2008-11-05 11:12:39 $
     11 *  @version $Revision: 1.133 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2009-02-06 01:05:58 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2424#include <math.h>
    2525#include <unistd.h>
     26#include <errno.h>
    2627
    2728#include "psMemory.h"
     
    2930#include "psAssert.h"
    3031#include "psAbort.h"
     32#include "psTrace.h"
    3133
    3234#include "psImage.h"
     
    5355
    5456        // drop my entry on my parent's array of children
     57        // lock parent before freeing child : psArrayRemoveDataNoFree is NOT thread safe
     58        psMutexLock (parent);
    5559        psArrayRemoveDataNoFree (parent->children, image);
     60        psMutexUnlock (parent);
    5661
    5762        // drop my reference to my parent
     
    6671    }
    6772
     73    psMutexDestroy(image);
    6874    psFree(image->children);
    6975    psFree(image->p_rawDataBuffer);
     
    122128    image->parent = NULL;
    123129    image->children = NULL;
     130
     131    // XXX for now, we will add a mutex to all images.  in the future, allow images to be
     132    // threaded or unthreaded independently?
     133    psMutexInit (image);
    124134
    125135    return image;
Note: See TracChangeset for help on using the changeset viewer.