IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21295


Ignore:
Timestamp:
Feb 4, 2009, 1:37:10 PM (17 years ago)
Author:
eugene
Message:

need to lock the refCounter mods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20090203/psLib/src/sys/psMemory.c

    r19128 r21295  
    1010*  @author Joshua Hoblitt, University of Hawaii
    1111*
    12 *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2008-08-20 02:00:20 $
     12*  @version $Revision: 1.100.22.1 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2009-02-04 23:37:10 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    736736    // XXX we probably need a MUTEX_LOCK here: otherwise, two functions can race on recCounter++ and
    737737    // refCounter--;
     738    MUTEX_LOCK(&memBlockListMutex);
    738739    memBlock->refCounter++;
     740    MUTEX_UNLOCK(&memBlockListMutex);
    739741
    740742    // Did the user ask to be informed about this allocation?
     
    802804    // if we have multiple references, just decrement the count and return.
    803805    // XXX we probably need a MUTEX_LOCK here: otherwise, two functions can race on refCounter--;
     806    MUTEX_LOCK(&memBlockListMutex);
    804807    if (memBlock->refCounter > 1) {
    805808        memBlock->refCounter--;
    806809
    807810        // Did the user ask to be informed about this deallocation?
    808         MUTEX_LOCK(&memBlockListMutex);
    809811        if (memBlock->id == p_psMemFreeID) {
    810812            p_psMemFreeID += memFreeCallback(memBlock);
     
    813815        return ptr;
    814816    }
     817    MUTEX_UNLOCK(&memBlockListMutex);
    815818
    816819    // we can't invoke freeFunc() while we're holding memBlockListMutex as it
Note: See TracChangeset for help on using the changeset viewer.