Changeset 10890 for branches/jch-memory/psLib/src/sys/psError.c
- Timestamp:
- Jan 3, 2007, 11:43:57 AM (19 years ago)
- File:
-
- 1 edited
-
branches/jch-memory/psLib/src/sys/psError.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jch-memory/psLib/src/sys/psError.c
r9730 r10890 11 11 * @author Eric Van Alst, MHPCC 12 12 * 13 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $14 * @date $Date: 200 6-10-24 22:52:56$13 * @version $Revision: 1.41.2.1 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-01-03 21:43:57 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 98 98 } 99 99 100 // This function serves the same purpose of psErrorStackGet() accept it does 101 // not alloc the error stack if it DOES NOT already exist. Unlike 102 // psErrorStackGet(), this function is NOT guarenteed to return a valid pointer 103 // and it's return status must be checked. 104 static psArray *psErrorStackGetNoAlloc(void) 105 { 106 // check to see if the error stack key has been initialized 107 pthread_mutex_lock(&lockErrorStack); 108 if (errorStackKeyInitialized == false) { 109 return NULL; 110 } 111 pthread_mutex_unlock(&lockErrorStack); 112 113 // check to see if the error stack for this thread has been allocated 114 psArray *errorStack = NULL; 115 if ((errorStack = pthread_getspecific(errorStack_key)) == NULL) { 116 return NULL; 117 } 118 119 return errorStack; 120 } 121 100 122 static void psErrFree(psErr* err) 101 123 { … … 260 282 } 261 283 284 // This function does not allocate any memory so it is safe to call from inside 285 // of psMemory.c. Do not allocate memory in function (or call any functions 286 // that do) without first removing it's use from psMemory.c. 262 287 void psErrorStackPrintV(FILE *fd, const char *format, va_list va) 263 288 { 264 psArray *errorStack = psErrorStackGet(); 289 psArray *errorStack = psErrorStackGetNoAlloc(); 290 // do nothing if there error stack has not been allocated 291 if (!errorStack) { 292 return; 293 } 265 294 266 295 vfprintf(fd, format, va);
Note:
See TracChangeset
for help on using the changeset viewer.
