Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: runtime/vm/simulator_mips.cc

Issue 999983004: simMutex (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/simulator_mips.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_mips.cc
===================================================================
--- runtime/vm/simulator_mips.cc (revision 44732)
+++ runtime/vm/simulator_mips.cc (working copy)
@@ -1102,13 +1102,13 @@
// Synchronization primitives support.
void Simulator::SetExclusiveAccess(uword addr) {
- Isolate* isolate = Isolate::Current();
- ASSERT(isolate != NULL);
- DEBUG_ASSERT(exclusive_access_lock_->Owner() == isolate);
+ Thread* thread = Thread::Current();
+ ASSERT(thread != NULL);
+ DEBUG_ASSERT(exclusive_access_lock_->IsOwnedByCurrentThread());
int i = 0;
- // Find an entry for this isolate in the exclusive access state.
+ // Find an entry for this thread in the exclusive access state.
while ((i < kNumAddressTags) &&
- (exclusive_access_state_[i].isolate != isolate)) {
+ (exclusive_access_state_[i].thread != thread)) {
i++;
}
// Round-robin replacement of previously used entries.
@@ -1117,7 +1117,7 @@
if (++next_address_tag_ == kNumAddressTags) {
next_address_tag_ = 0;
}
- exclusive_access_state_[i].isolate = isolate;
+ exclusive_access_state_[i].thread = thread;
}
// Remember the address being reserved.
exclusive_access_state_[i].addr = addr;
@@ -1125,20 +1125,20 @@
bool Simulator::HasExclusiveAccessAndOpen(uword addr) {
- Isolate* isolate = Isolate::Current();
- ASSERT(isolate != NULL);
+ Thread* thread = Thread::Current();
+ ASSERT(thread != NULL);
ASSERT(addr != 0);
- DEBUG_ASSERT(exclusive_access_lock_->Owner() == isolate);
+ DEBUG_ASSERT(exclusive_access_lock_->IsOwnedByCurrentThread());
bool result = false;
for (int i = 0; i < kNumAddressTags; i++) {
- if (exclusive_access_state_[i].isolate == isolate) {
- // Check whether the current isolate's address reservation matches.
+ if (exclusive_access_state_[i].thread == thread) {
+ // Check whether the current thread's address reservation matches.
if (exclusive_access_state_[i].addr == addr) {
result = true;
}
exclusive_access_state_[i].addr = 0;
} else if (exclusive_access_state_[i].addr == addr) {
- // Other isolates with matching address lose their reservations.
+ // Other threads with matching address lose their reservations.
exclusive_access_state_[i].addr = 0;
}
}
@@ -1148,7 +1148,7 @@
void Simulator::ClearExclusive() {
MutexLocker ml(exclusive_access_lock_);
- // Remove the reservation for this isolate.
+ // Remove the reservation for this thread.
SetExclusiveAccess(NULL);
}
@@ -1176,7 +1176,7 @@
uword new_value) {
MutexLocker ml(exclusive_access_lock_);
// We do not get a reservation as it would be guaranteed to be found when
- // writing below. No other isolate is able to make a reservation while we
+ // writing below. No other thread is able to make a reservation while we
// hold the lock.
uword value = *address;
if (value == compare_value) {
« no previous file with comments | « runtime/vm/simulator_mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698