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

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

Issue 1473403003: Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone e… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-code-review Created 5 years 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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Returns the number threads that are scheduled on this isolate. 67 // Returns the number threads that are scheduled on this isolate.
68 // Note: Lock should be taken before this function is called. 68 // Note: Lock should be taken before this function is called.
69 intptr_t CountScheduledLocked(); 69 intptr_t CountScheduledLocked();
70 70
71 Monitor* monitor_; // All access is synchronized through this monitor. 71 Monitor* monitor_; // All access is synchronized through this monitor.
72 Thread* active_list_; // List of active threads in the isolate. 72 Thread* active_list_; // List of active threads in the isolate.
73 Thread* free_list_; // Free list of Thread objects that can be reused. 73 Thread* free_list_; // Free list of Thread objects that can be reused.
74 // TODO(asiva): Currently we treat a mutator thread as a special thread 74 // TODO(asiva): Currently we treat a mutator thread as a special thread
75 // and always schedule execution of Dart code on the same mutator thread 75 // and always schedule execution of Dart code on the same mutator thread
76 // object. This is because ApiState is still an object associated with 76 // object. The ApiLocalScope has been made thread specific but we still
77 // the isolate and switching execution to another thread causes problems. 77 // have scenarios where we do a temporary exit of an Isolate with live
78 // Once ApiState is made a per Thread object it should be possible to 78 // zones/handles in the the API scope :
79 // free a mutator thread like all other threads and continue running on 79 // - Dart_RunLoop()
80 // a different thread. 80 // - IsolateSaver in Dart_NewNativePort
81 // - Isolate spawn (function/uri) under FLAG_i_like_slow_isolate_spawn
82 // We probably need a mechanism to return to the specific thread only
83 // for these specific cases, we should also determine if we should allow
zra 2015/11/25 17:36:56 cases. We
siva 2015/11/25 18:25:08 Done.
84 // the embedder to exit an isolate with live state in zones/handles in
85 // which case a new API for returning to the specific thread needs to be
86 // added.
81 Thread* mutator_thread_; 87 Thread* mutator_thread_;
82 88
83 // Safepoint rendezvous state. 89 // Safepoint rendezvous state.
84 bool in_rendezvous_; // A safepoint rendezvous request is in progress. 90 bool in_rendezvous_; // A safepoint rendezvous request is in progress.
85 intptr_t remaining_; // Number of threads yet to reach their safepoint. 91 intptr_t remaining_; // Number of threads yet to reach their safepoint.
86 int64_t round_; // Counter, to prevent missing updates to remaining_ 92 int64_t round_; // Counter, to prevent missing updates to remaining_
87 // (see comments in CheckSafepointLocked). 93 // (see comments in CheckSafepointLocked).
88 94
89 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); 95 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry);
90 }; 96 };
91 97
92 } // namespace dart 98 } // namespace dart
93 99
94 #endif // VM_THREAD_REGISTRY_H_ 100 #endif // VM_THREAD_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698