- Timestamp:
- Feb 4, 2009, 1:36:56 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20090203/psLib/src/imageops/psImageStructManip.c
r15492 r21294 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $11 * @date $Date: 200 7-11-08 01:09:48$10 * @version $Revision: 1.20.42.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2009-02-04 23:36:56 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 21 21 #include <string.h> 22 22 #include <assert.h> 23 #include <errno.h> 23 24 24 25 #include "psMemory.h" 25 26 #include "psError.h" 26 27 #include "psAbort.h" 28 #include "psTrace.h" 27 29 28 30 #include "psImageStructManip.h" … … 100 102 psPtr rawData = psMemIncrRefCounter(image->p_rawDataBuffer); 101 103 104 // XXX worry about this later... 102 105 if (out != NULL) { 103 106 // if a child, need to orphan (disassociate from parent) first … … 108 111 109 112 // drop my entry on my parent's array of children 113 psMutexLock (out); 110 114 psArrayRemoveDataNoFree (out->parent->children, out); 115 psMutexUnlock (out); 111 116 112 117 // drop my reference to my old parent … … 119 124 out = p_psAlloc(file, lineno, func, sizeof(psImage)); 120 125 out->data.V = NULL; 126 psMutexInit (out); 121 127 } 122 128 … … 129 135 P_PSIMAGE_SET_ROW0(out, row0); 130 136 137 // As long as I have a valid image reference, no one else can free it to zero (I have at 138 // least the last reference) 131 139 out->parent = psMemIncrRefCounter(image); // track references to parents 132 140 out->children = NULL; … … 144 152 } 145 153 146 // add output image as a child of the input image. 154 // Add output image as a child of the input image. Lock image before performing this 155 // operation (psArrayAdd is NOT thread-safe) 156 psMutexLock (image); 147 157 image->children = p_psArrayAdd(file, lineno, func, image->children, 16, out); 158 psMutexUnlock (image); 159 148 160 psFree (out); // the image->children array is an array of views only 149 150 161 return (out); 151 162 }
Note:
See TracChangeset
for help on using the changeset viewer.
