OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 // This monitor protects the threads list for an isolate, it is used whenever | 41 // This monitor protects the threads list for an isolate, it is used whenever |
42 // we need to iterate over threads (both active and free) in an isolate. | 42 // we need to iterate over threads (both active and free) in an isolate. |
43 Monitor* threads_lock_; | 43 Monitor* threads_lock_; |
44 Thread* active_list_; // List of active threads in the isolate. | 44 Thread* active_list_; // List of active threads in the isolate. |
45 Thread* free_list_; // Free list of Thread objects that can be reused. | 45 Thread* free_list_; // Free list of Thread objects that can be reused. |
46 | 46 |
47 // TODO(asiva): Currently we treat a mutator thread as a special thread | 47 // TODO(asiva): Currently we treat a mutator thread as a special thread |
48 // and always schedule execution of Dart code on the same mutator thread | 48 // and always schedule execution of Dart code on the same mutator thread |
49 // object. The ApiLocalScope has been made thread specific but we still | 49 // object. The ApiLocalScope has been made thread specific but we still |
50 // have scenarios where we do a temporary exit of an Isolate with live | 50 // have scenarios where we do a temporary exit of an Isolate with live |
51 // zones/handles in the the API scope : | 51 // zones/handles in the API scope : |
52 // - Dart_RunLoop() | 52 // - Dart_RunLoop() |
53 // - IsolateSaver in Dart_NewNativePort | 53 // - IsolateSaver in Dart_NewNativePort |
54 // - Isolate spawn (function/uri) under FLAG_i_like_slow_isolate_spawn | 54 // - Isolate spawn (function/uri) under FLAG_i_like_slow_isolate_spawn |
55 // We probably need a mechanism to return to the specific thread only | 55 // We probably need a mechanism to return to the specific thread only |
56 // for these specific cases. We should also determine if the embedder | 56 // for these specific cases. We should also determine if the embedder |
57 // should allow exiting an isolate with live state in zones/handles in | 57 // should allow exiting an isolate with live state in zones/handles in |
58 // which case a new API for returning to the specific thread needs to be | 58 // which case a new API for returning to the specific thread needs to be |
59 // added. | 59 // added. |
60 Thread* mutator_thread_; | 60 Thread* mutator_thread_; |
61 | 61 |
62 friend class Isolate; | 62 friend class Isolate; |
63 friend class SafepointHandler; | 63 friend class SafepointHandler; |
64 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); | 64 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); |
65 }; | 65 }; |
66 | 66 |
67 } // namespace dart | 67 } // namespace dart |
68 | 68 |
69 #endif // VM_THREAD_REGISTRY_H_ | 69 #endif // VM_THREAD_REGISTRY_H_ |
OLD | NEW |