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

Unified Diff: runtime/vm/thread_registry.h

Issue 1226103010: Remove static Mutex construction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_registry.h
diff --git a/runtime/vm/thread_registry.h b/runtime/vm/thread_registry.h
index bbabea2225807dc99440503e4703eb9dc34d3aca..d4de8a3fa469bca7fffb194ccf1713f27baf2ee8 100644
--- a/runtime/vm/thread_registry.h
+++ b/runtime/vm/thread_registry.h
@@ -16,10 +16,10 @@ namespace dart {
// Unordered collection of threads relating to a particular isolate.
class ThreadRegistry {
public:
- ThreadRegistry() : mutex_(), entries_() {}
+ ThreadRegistry() : mutex_(new Mutex()), entries_() {}
bool RestoreStateTo(Thread* thread, Thread::State* state) {
- MutexLocker ml(&mutex_);
+ MutexLocker ml(mutex_);
Entry* entry = FindEntry(thread);
if (entry != NULL) {
Thread::State st = entry->state;
@@ -50,7 +50,7 @@ class ThreadRegistry {
}
void SaveStateFrom(Thread* thread, const Thread::State& state) {
- MutexLocker ml(&mutex_);
+ MutexLocker ml(mutex_);
Entry* entry = FindEntry(thread);
ASSERT(entry != NULL);
ASSERT(entry->scheduled);
@@ -59,12 +59,12 @@ class ThreadRegistry {
}
bool Contains(Thread* thread) {
- MutexLocker ml(&mutex_);
+ MutexLocker ml(mutex_);
return (FindEntry(thread) != NULL);
}
void VisitObjectPointers(ObjectPointerVisitor* visitor) {
- MutexLocker ml(&mutex_);
+ MutexLocker ml(mutex_);
for (int i = 0; i < entries_.length(); ++i) {
const Entry& entry = entries_[i];
Zone* zone = entry.scheduled ? entry.thread->zone() : entry.state.zone;
@@ -84,7 +84,7 @@ class ThreadRegistry {
// Returns Entry corresponding to thread in registry or NULL.
// Note: Lock should be taken before this function is called.
Entry* FindEntry(Thread* thread) {
- DEBUG_ASSERT(mutex_.IsOwnedByCurrentThread());
+ DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread());
for (int i = 0; i < entries_.length(); ++i) {
if (entries_[i].thread == thread) {
return &entries_[i];
@@ -93,7 +93,7 @@ class ThreadRegistry {
return NULL;
}
- Mutex mutex_;
+ Mutex* mutex_;
MallocGrowableArray<Entry> entries_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698