Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 8811)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 8812)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-09-13 21:14:48 $
+*  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-09-14 22:27:29 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -291,5 +291,15 @@
 psMemId psMemGetLastId(void)
 {
-    return memid;
+    if (safeThreads) {
+        pthread_mutex_lock(&memIdMutex);
+    }
+
+    psMemId id = memid;
+
+    if (safeThreads) {
+        pthread_mutex_unlock(&memIdMutex);
+    }
+
+    return id;
 }
 
