Index: runtime/vm/isolate.cc |
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
index d0fa2bf580b75618591044edf97f09ca804cfb51..2f77c59e695043ee2a0cb3f314beba0ab9a2f657 100644 |
--- a/runtime/vm/isolate.cc |
+++ b/runtime/vm/isolate.cc |
@@ -1668,7 +1668,8 @@ void Isolate::TrackDeoptimizedCode(const Code& code) { |
void Isolate::WakePauseEventHandler(Dart_Isolate isolate) { |
- Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
+ Isolate* iso = FindIsolateInList(isolate); |
+ ASSERT(iso != NULL); |
MonitorLocker ml(iso->pause_loop_monitor_); |
ml.Notify(); |
} |
@@ -1737,6 +1738,20 @@ intptr_t Isolate::IsolateListLength() { |
} |
+Isolate* Isolate::FindIsolateInList(Dart_Isolate isolate) { |
+ MonitorLocker ml(isolates_list_monitor_); |
+ Isolate* current = isolates_list_head_; |
+ while (current != NULL) { |
+ if (Api::CastIsolate(current) == isolate) { |
+ // We've found the isolate. |
+ return current; |
+ } |
+ current = current->next_; |
+ } |
+ return NULL; |
+} |
+ |
+ |
void Isolate::AddIsolateTolist(Isolate* isolate) { |
MonitorLocker ml(isolates_list_monitor_); |
ASSERT(isolate != NULL); |