diff --git a/hpvm/projects/visc-rt/visc-rt.cpp b/hpvm/projects/visc-rt/visc-rt.cpp
index c5ce64dc4b3a9e0e3f48f3568215609284fe386c..e4fddca19e4de480648941640d9688e71c85295e 100644
--- a/hpvm/projects/visc-rt/visc-rt.cpp
+++ b/hpvm/projects/visc-rt/visc-rt.cpp
@@ -122,28 +122,38 @@ void llvm_visc_x86_dstack_push(unsigned n, uint64_t limitX, uint64_t iX, uint64_
     DEBUG(cout << "\tNumDim = " << n << "\t Limit(" << limitX << ", " << limitY << ", "<< limitZ <<")\n");
     DEBUG(cout << "\tInstance(" << iX << ", " << iY << ", "<< iZ <<")\n");
     DFGDepth nodeInfo (n, limitX, iX, limitY, iY, limitZ, iZ);
+    pthread_mutex_lock(&ocl_mtx);
     DStack.push_back(nodeInfo);
     DEBUG(cout << "DStack size = " << DStack.size() << flush << "\n");
+    pthread_mutex_unlock(&ocl_mtx);
 }
 
 void llvm_visc_x86_dstack_pop() {
     DEBUG(cout << "Popping from depth stack\n");
+    pthread_mutex_lock(&ocl_mtx);
     DStack.pop_back();
     DEBUG(cout << "DStack size = " << DStack.size() << flush << "\n");
+    pthread_mutex_unlock(&ocl_mtx);
 }
 
 uint64_t llvm_visc_x86_getDimLimit(unsigned level, unsigned dim) {
    DEBUG(cout << "Request limit for dim " << dim << " of ancestor " << level <<flush << "\n");
+   pthread_mutex_lock(&ocl_mtx);
    unsigned size = DStack.size();
    DEBUG(cout << "\t Return: " << DStack[size-level-1].getDimLimit(dim) <<flush << "\n");
-   return DStack[size-level-1].getDimLimit(dim);
+   uint64_t result = DStack[size-level-1].getDimLimit(dim);
+   pthread_mutex_unlock(&ocl_mtx);
+   return result;
 }
 
 uint64_t llvm_visc_x86_getDimInstance(unsigned level, unsigned dim) {
     DEBUG(cout << "Request instance id for dim " << dim << " of ancestor " << level <<flush << "\n");
+    pthread_mutex_lock(&ocl_mtx);
     unsigned size = DStack.size();
     DEBUG(cout << "\t Return: " << DStack[size-level-1].getDimInstance(dim) <<flush << "\n");
-    return DStack[size-level-1].getDimInstance(dim);
+    uint64_t result = DStack[size-level-1].getDimInstance(dim);
+    pthread_mutex_unlock(&ocl_mtx);
+    return result;
 }
 
 /********************** Memory Tracking Routines **************************/