[llvm-commits] [vmkit] r50417 - /vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Apr 29 03:34:07 PDT 2008


Author: geoffray
Date: Tue Apr 29 05:34:07 2008
New Revision: 50417

URL: http://llvm.org/viewvc/llvm-project?rev=50417&view=rev
Log:
Lock the domain when updateing its thread count.


Modified:
    vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp

Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp?rev=50417&r1=50416&r2=50417&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp Tue Apr 29 05:34:07 2008
@@ -72,7 +72,10 @@
   }
   
 #ifdef SERVICE_VM
-  ((ServiceDomain*)isolate)->numThreads++;
+  ServiceDomain* vm = (ServiceDomain*)isolate;
+  vm->lock->lock();
+  vm->numThreads++;
+  vm->lock->unlock();
 #endif
   JavaMethod* method = vmthClass->lookupMethod(Jnjvm::runName, Jnjvm::clinitType, ACC_VIRTUAL, true);
   method->invokeIntSpecial(isolate, vmThread);
@@ -87,7 +90,9 @@
   }
 
 #ifdef SERVICE_VM
-  ((ServiceDomain*)isolate)->numThreads--;
+  vm->lock->lock();
+  vm->numThreads--;
+  vm->lock->unlock();
 #endif
 
 #ifdef MULTIPLE_GC





More information about the llvm-commits mailing list