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

Side by Side Diff: runtime/vm/thread_registry.h

Issue 1233563004: Avoid race in isolate shutdown; add assertions, error messages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Move wait per suggestion; port to all platforms. 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/thread.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_THREAD_REGISTRY_H_ 5 #ifndef VM_THREAD_REGISTRY_H_
6 #define VM_THREAD_REGISTRY_H_ 6 #define VM_THREAD_REGISTRY_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ASSERT(entry->scheduled); 56 ASSERT(entry->scheduled);
57 entry->scheduled = false; 57 entry->scheduled = false;
58 entry->state = state; 58 entry->state = state;
59 } 59 }
60 60
61 bool Contains(Thread* thread) { 61 bool Contains(Thread* thread) {
62 MutexLocker ml(mutex_); 62 MutexLocker ml(mutex_);
63 return (FindEntry(thread) != NULL); 63 return (FindEntry(thread) != NULL);
64 } 64 }
65 65
66 void CheckNotScheduled(Isolate* isolate) {
67 MutexLocker ml(mutex_);
68 for (int i = 0; i < entries_.length(); ++i) {
69 const Entry& entry = entries_[i];
70 if (entry.scheduled) {
71 FATAL3("Isolate %p still scheduled on %p (whose isolate_ is %p)\n",
72 isolate,
73 entry.thread,
74 entry.thread->isolate());
75 }
76 }
77 }
78
66 void VisitObjectPointers(ObjectPointerVisitor* visitor) { 79 void VisitObjectPointers(ObjectPointerVisitor* visitor) {
67 MutexLocker ml(mutex_); 80 MutexLocker ml(mutex_);
68 for (int i = 0; i < entries_.length(); ++i) { 81 for (int i = 0; i < entries_.length(); ++i) {
69 const Entry& entry = entries_[i]; 82 const Entry& entry = entries_[i];
70 Zone* zone = entry.scheduled ? entry.thread->zone() : entry.state.zone; 83 Zone* zone = entry.scheduled ? entry.thread->zone() : entry.state.zone;
71 if (zone != NULL) { 84 if (zone != NULL) {
72 zone->VisitObjectPointers(visitor); 85 zone->VisitObjectPointers(visitor);
73 } 86 }
74 } 87 }
75 } 88 }
(...skipping 20 matching lines...) Expand all
96 Mutex* mutex_; 109 Mutex* mutex_;
97 MallocGrowableArray<Entry> entries_; 110 MallocGrowableArray<Entry> entries_;
98 111
99 112
100 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); 113 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry);
101 }; 114 };
102 115
103 } // namespace dart 116 } // namespace dart
104 117
105 #endif // VM_THREAD_REGISTRY_H_ 118 #endif // VM_THREAD_REGISTRY_H_
OLDNEW
« no previous file with comments | « runtime/vm/thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698