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 VM_THREAD_POOL_H_ | 5 #ifndef VM_THREAD_POOL_H_ |
6 #define VM_THREAD_POOL_H_ | 6 #define 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 bool RemoveWorkerFromIdleList(Worker* worker); | 119 bool RemoveWorkerFromIdleList(Worker* worker); |
120 bool RemoveWorkerFromAllList(Worker* worker); | 120 bool RemoveWorkerFromAllList(Worker* worker); |
121 | 121 |
122 void AddWorkerToShutdownList(Worker* worker); | 122 void AddWorkerToShutdownList(Worker* worker); |
123 bool RemoveWorkerFromShutdownList(Worker* worker); | 123 bool RemoveWorkerFromShutdownList(Worker* worker); |
124 | 124 |
125 void ReapExitedIdleThreads(); | 125 void ReapExitedIdleThreads(); |
126 | 126 |
127 // Worker operations. | 127 // Worker operations. |
| 128 void SetIdleLocked(Worker* worker); // Assumes mutex_ is held. |
128 void SetIdleAndReapExited(Worker* worker); | 129 void SetIdleAndReapExited(Worker* worker); |
129 bool ReleaseIdleWorker(Worker* worker); | 130 bool ReleaseIdleWorker(Worker* worker); |
130 | 131 |
131 Mutex mutex_; | 132 Mutex mutex_; |
132 bool shutting_down_; | 133 bool shutting_down_; |
133 Worker* all_workers_; | 134 Worker* all_workers_; |
134 Worker* idle_workers_; | 135 Worker* idle_workers_; |
135 uint64_t count_started_; | 136 uint64_t count_started_; |
136 uint64_t count_stopped_; | 137 uint64_t count_stopped_; |
137 uint64_t count_running_; | 138 uint64_t count_running_; |
138 uint64_t count_idle_; | 139 uint64_t count_idle_; |
139 | 140 |
140 Monitor exit_monitor_; | 141 Monitor exit_monitor_; |
141 Worker* shutting_down_workers_; | 142 Worker* shutting_down_workers_; |
142 JoinList* join_list_; | 143 JoinList* join_list_; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(ThreadPool); | 145 DISALLOW_COPY_AND_ASSIGN(ThreadPool); |
145 }; | 146 }; |
146 | 147 |
147 } // namespace dart | 148 } // namespace dart |
148 | 149 |
149 #endif // VM_THREAD_POOL_H_ | 150 #endif // VM_THREAD_POOL_H_ |
OLD | NEW |