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

Side by Side Diff: runtime/vm/isolate.cc

Issue 1307833002: - Prevent interrupting the NULL thread when the isolate is (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 // Paused at breakpoint. Don't tick. 1759 // Paused at breakpoint. Don't tick.
1760 return 0; 1760 return 0;
1761 } 1761 }
1762 MessageHandler* msg_handler = message_handler(); 1762 MessageHandler* msg_handler = message_handler();
1763 if ((msg_handler != NULL) && 1763 if ((msg_handler != NULL) &&
1764 (msg_handler->paused_on_start() || 1764 (msg_handler->paused_on_start() ||
1765 msg_handler->paused_on_exit())) { 1765 msg_handler->paused_on_exit())) {
1766 // Paused at start / exit . Don't tick. 1766 // Paused at start / exit . Don't tick.
1767 return 0; 1767 return 0;
1768 } 1768 }
1769 if (mutator_thread_ == NULL) { 1769 // Make sure that the isolate's mutator thread does not change behind our
1770 // backs. Otherwise we find the entry in the registry and end up reading
1771 // the field again. Only by that time it has been reset to NULL because the
1772 // thread was in process of exiting the isolate.
1773 Thread* mutator = mutator_thread_;
1774 if (mutator == NULL) {
1770 // No active mutator. 1775 // No active mutator.
1771 ProfileIdle(); 1776 ProfileIdle();
1772 return 1; 1777 return 1;
1773 } 1778 }
1774 1779
1775 // TODO(johnmccutchan): Sample all threads, not just the mutator thread. 1780 // TODO(johnmccutchan): Sample all threads, not just the mutator thread.
1776 // TODO(johnmccutchan): Keep a global list of threads and use that 1781 // TODO(johnmccutchan): Keep a global list of threads and use that
1777 // instead of Isolate. 1782 // instead of Isolate.
1778 ThreadRegistry::EntryIterator it(thread_registry()); 1783 ThreadRegistry::EntryIterator it(thread_registry());
1779 while (it.HasNext()) { 1784 while (it.HasNext()) {
1780 const ThreadRegistry::Entry& entry = it.Next(); 1785 const ThreadRegistry::Entry& entry = it.Next();
1781 if (entry.thread == mutator_thread_) { 1786 if (entry.thread == mutator) {
1782 ThreadInterrupter::InterruptThread(mutator_thread_); 1787 ThreadInterrupter::InterruptThread(mutator);
1783 break; 1788 break;
1784 } 1789 }
1785 } 1790 }
1786 return 1; 1791 return 1;
1787 } 1792 }
1788 1793
1789 1794
1790 void Isolate::ProfileIdle() { 1795 void Isolate::ProfileIdle() {
1791 vm_tag_counters_.Increment(vm_tag()); 1796 vm_tag_counters_.Increment(vm_tag());
1792 } 1797 }
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 serialized_message_, serialized_message_len_); 2147 serialized_message_, serialized_message_len_);
2143 } 2148 }
2144 2149
2145 2150
2146 void IsolateSpawnState::Cleanup() { 2151 void IsolateSpawnState::Cleanup() {
2147 SwitchIsolateScope switch_scope(I); 2152 SwitchIsolateScope switch_scope(I);
2148 Dart::ShutdownIsolate(); 2153 Dart::ShutdownIsolate();
2149 } 2154 }
2150 2155
2151 } // namespace dart 2156 } // namespace dart
OLDNEW
« 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