[vmkit-commits] [vmkit] r120962 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/VMKit.cpp
Gael Thomas
gael.thomas at lip6.fr
Sun Dec 5 14:39:57 PST 2010
Author: gthomas
Date: Sun Dec 5 16:39:56 2010
New Revision: 120962
URL: http://llvm.org/viewvc/llvm-project?rev=120962&view=rev
Log:
uses a function of vmkit to lock vmkit
Modified:
vmkit/branches/multi-vm/include/mvm/VMKit.h
vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp
vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp
vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120962&r1=120961&r2=120962&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/VMKit.h (original)
+++ vmkit/branches/multi-vm/include/mvm/VMKit.h Sun Dec 5 16:39:56 2010
@@ -44,7 +44,10 @@
VMKit(mvm::BumpPtrAllocator &Alloc);
- SpinLock vmkitLock;
+ SpinLock _vmkitLock;
+
+ void vmkitLock() { _vmkitLock.lock(); }
+ void vmkitUnlock() { _vmkitLock.unlock(); }
/// ------------------------------------------------- ///
/// --- vm managment --- ///
Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120962&r1=120961&r2=120962&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Sun Dec 5 16:39:56 2010
@@ -53,7 +53,7 @@
// Lock thread lock, so that we can traverse the thread list safely. This will
// be released on finishRV.
- vmkit->vmkitLock.lock();
+ vmkit->vmkitLock();
for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) {
assert(!cur->doYield);
@@ -94,7 +94,7 @@
// Lock thread lock, so that we can traverse the thread list safely. This will
// be released on finishRV.
- self->vmkit->vmkitLock.lock();
+ self->vmkit->vmkitLock();
for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) {
if(cur!=self) {
@@ -207,7 +207,7 @@
assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state");
nbJoined = 0;
- initiator->vmkit->vmkitLock.unlock();
+ initiator->vmkit->vmkitUnlock();
condEndRV.broadcast();
unlockRV();
initiator->inRV = false;
@@ -222,7 +222,7 @@
mvm::Thread* initiator = mvm::Thread::get();
assert(nbJoined == initiator->vmkit->NumberOfThreads && "Inconsistent state");
nbJoined = 0;
- initiator->vmkit->vmkitLock.unlock();
+ initiator->vmkit->vmkitUnlock();
condEndRV.broadcast();
unlockRV();
initiator->inRV = false;
Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120962&r1=120961&r2=120962&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 16:39:56 2010
@@ -49,9 +49,9 @@
vmData = allVmsData[vm->vmID];
if(!vmData) {
- vmkit->vmkitLock.lock();
+ vmkit->vmkitLock();
vmData = allVmsData[vm->vmID] = vm->buildVMThreadData(this);
- vmkit->vmkitLock.unlock();
+ vmkit->vmkitUnlock();
}
}
Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120962&r1=120961&r2=120962&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 16:39:56 2010
@@ -9,12 +9,12 @@
}
size_t VMKit::addVM(VirtualMachine* vm) {
- vmkitLock.lock();
+ vmkitLock();
for(size_t i=0; i<numberOfVms; i++)
if(!vms[i]) {
vms[i] = vm;
- vmkitLock.unlock();
+ vmkitUnlock();
return i;
}
@@ -36,7 +36,7 @@
cur->reallocAllVmsData(res, numberOfVms);
}
- vmkitLock.unlock();
+ vmkitUnlock();
return res;
}
@@ -47,35 +47,35 @@
}
void VMKit::registerPreparedThread(mvm::Thread* th) {
- vmkitLock.lock();
+ vmkitLock();
th->appendTo(&preparedThreads);
th->reallocAllVmsData(0, numberOfVms);
- vmkitLock.unlock();
+ vmkitUnlock();
}
void VMKit::unregisterPreparedThread(mvm::Thread* th) {
- vmkitLock.lock();
+ vmkitLock();
numberOfRunningThreads--;
th->remove();
//for(int i=0; i<numberOfVms; i++)
//if(th->allVmsData[i])
// delete th->allVmsData[i]; -> Must make a choice for the destruction of threads...
delete th->allVmsData;
- vmkitLock.unlock();
+ vmkitUnlock();
}
void VMKit::registerRunningThread(mvm::Thread* th) {
- vmkitLock.lock();
+ vmkitLock();
numberOfRunningThreads++;
th->remove();
th->appendTo(&runningThreads);
- vmkitLock.unlock();
+ vmkitUnlock();
}
void VMKit::unregisterRunningThread(mvm::Thread* th) {
- vmkitLock.lock();
+ vmkitLock();
numberOfRunningThreads--;
th->remove();
th->appendTo(&preparedThreads);
- vmkitLock.unlock();
+ vmkitUnlock();
}
More information about the vmkit-commits
mailing list