Index: /trunk/Ohana/src/opihi/lib.shell/VectorOps.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/VectorOps.c	(revision 16886)
+++ /trunk/Ohana/src/opihi/lib.shell/VectorOps.c	(revision 16887)
@@ -4,4 +4,7 @@
 static int     Nvectors;
   
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+// this function is NOT thread protected : it is only used in startup and/or shutdown
 void InitVectors () {
   Nvectors = 0;
@@ -9,4 +12,5 @@
 }
 
+// this function is NOT thread protected : it is only used in startup and/or shutdown
 void FreeVectors () {
 
@@ -64,8 +68,10 @@
   if (i == Nvectors) { 
     if (mode == OLDVECTOR) goto error;
-    Nvectors += 1;
+    pthread_mutex_lock (&mutex);
+    Nvectors ++;
     REALLOCATE (vectors, Vector *, Nvectors);
     vectors[i] = InitVector ();
     strcpy (vectors[i][0].name, name);
+    pthread_mutex_unlock (&mutex);
     return (vectors[i]);
   } 
@@ -91,8 +97,10 @@
   free (vectors[i][0].elements);
   free (vectors[i]);
+
+  pthread_mutex_lock (&mutex);
   for (j = i; j < Nvectors - 1; j++) vectors[j] = vectors[j + 1];
-
-  Nvectors -= 1;
+  Nvectors --;
   REALLOCATE (vectors, Vector *, MAX (Nvectors, 1));
+  pthread_mutex_unlock (&mutex);
   return (TRUE);
 }
@@ -109,8 +117,10 @@
   free (vectors[i][0].elements);
   free (vectors[i]);
+
+  pthread_mutex_lock (&mutex);
   for (j = i; j < Nvectors - 1; j++) vectors[j] = vectors[j + 1];
-
-  Nvectors -= 1;
+  Nvectors --;
   REALLOCATE (vectors, Vector *, MAX (Nvectors, 1));
+  pthread_mutex_unlock (&mutex);
   return (TRUE);
 }
@@ -154,8 +164,10 @@
   }
 
+  pthread_mutex_lock (&mutex);
   for (j = i; j < Nvectors - 1; j++) vectors[j] = vectors[j + 1];
-  Nvectors -= 1;
+  Nvectors --;
   REALLOCATE (vectors, Vector *, MAX (Nvectors, 1));
   free (in);
+  pthread_mutex_unlock (&mutex);
   return (TRUE);
 }
