OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 RUNTIME_VM_THREAD_POOL_H_ | 5 #ifndef RUNTIME_VM_THREAD_POOL_H_ |
6 #define RUNTIME_VM_THREAD_POOL_H_ | 6 #define RUNTIME_VM_THREAD_POOL_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 Worker* all_next_; // Protected by ThreadPool::mutex_ | 86 Worker* all_next_; // Protected by ThreadPool::mutex_ |
87 Worker* idle_next_; // Protected by ThreadPool::mutex_ | 87 Worker* idle_next_; // Protected by ThreadPool::mutex_ |
88 | 88 |
89 Worker* shutdown_next_; // Protected by ThreadPool::exit_monitor | 89 Worker* shutdown_next_; // Protected by ThreadPool::exit_monitor |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(Worker); | 91 DISALLOW_COPY_AND_ASSIGN(Worker); |
92 }; | 92 }; |
93 | 93 |
94 class JoinList { | 94 class JoinList { |
95 public: | 95 public: |
96 explicit JoinList(ThreadJoinId id, JoinList* next) : id_(id), next_(next) { | 96 explicit JoinList(ThreadJoinId id, JoinList* next) : id_(id), next_(next) {} |
97 } | |
98 | 97 |
99 // The thread pool's mutex_ must be held when calling this. | 98 // The thread pool's mutex_ must be held when calling this. |
100 static void AddLocked(ThreadJoinId id, JoinList** list); | 99 static void AddLocked(ThreadJoinId id, JoinList** list); |
101 | 100 |
102 static void Join(JoinList** list); | 101 static void Join(JoinList** list); |
103 | 102 |
104 ThreadJoinId id() const { return id_; } | 103 ThreadJoinId id() const { return id_; } |
105 JoinList* next() const { return next_; } | 104 JoinList* next() const { return next_; } |
106 | 105 |
107 private: | 106 private: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 Monitor exit_monitor_; | 140 Monitor exit_monitor_; |
142 Worker* shutting_down_workers_; | 141 Worker* shutting_down_workers_; |
143 JoinList* join_list_; | 142 JoinList* join_list_; |
144 | 143 |
145 DISALLOW_COPY_AND_ASSIGN(ThreadPool); | 144 DISALLOW_COPY_AND_ASSIGN(ThreadPool); |
146 }; | 145 }; |
147 | 146 |
148 } // namespace dart | 147 } // namespace dart |
149 | 148 |
150 #endif // RUNTIME_VM_THREAD_POOL_H_ | 149 #endif // RUNTIME_VM_THREAD_POOL_H_ |
OLD | NEW |