OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_THREADING_THREAD_H_ | 5 #ifndef BASE_THREADING_THREAD_H_ |
6 #define BASE_THREADING_THREAD_H_ | 6 #define BASE_THREADING_THREAD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Should be written on the thread that created this thread. Also read data | 257 // Should be written on the thread that created this thread. Also read data |
258 // could be wrong on other threads. | 258 // could be wrong on other threads. |
259 bool stopping_ = false; | 259 bool stopping_ = false; |
260 | 260 |
261 // True while inside of Run(). | 261 // True while inside of Run(). |
262 bool running_ = false; | 262 bool running_ = false; |
263 mutable base::Lock running_lock_; // Protects |running_|. | 263 mutable base::Lock running_lock_; // Protects |running_|. |
264 | 264 |
265 // The thread's handle. | 265 // The thread's handle. |
266 PlatformThreadHandle thread_; | 266 PlatformThreadHandle thread_; |
267 mutable base::Lock thread_lock_; // Protects |thread_|. | |
268 | 267 |
269 // The thread's id once it has started. | 268 // The thread's id once it has started. |
270 PlatformThreadId id_ = kInvalidThreadId; | 269 PlatformThreadId id_ = kInvalidThreadId; |
271 mutable WaitableEvent id_event_; // Protects |id_|. | 270 mutable WaitableEvent id_event_; // Protects |id_|. |
272 | 271 |
273 // The thread's MessageLoop and RunLoop. Valid only while the thread is alive. | 272 // The thread's MessageLoop and RunLoop. Valid only while the thread is alive. |
274 // Set by the created thread. | 273 // Set by the created thread. |
275 MessageLoop* message_loop_ = nullptr; | 274 MessageLoop* message_loop_ = nullptr; |
276 RunLoop* run_loop_ = nullptr; | 275 RunLoop* run_loop_ = nullptr; |
277 | 276 |
(...skipping 10 matching lines...) Expand all Loading... |
288 // This class is not thread-safe, use this to verify access from the owning | 287 // This class is not thread-safe, use this to verify access from the owning |
289 // sequence of the Thread. | 288 // sequence of the Thread. |
290 SequenceChecker owning_sequence_checker_; | 289 SequenceChecker owning_sequence_checker_; |
291 | 290 |
292 DISALLOW_COPY_AND_ASSIGN(Thread); | 291 DISALLOW_COPY_AND_ASSIGN(Thread); |
293 }; | 292 }; |
294 | 293 |
295 } // namespace base | 294 } // namespace base |
296 | 295 |
297 #endif // BASE_THREADING_THREAD_H_ | 296 #endif // BASE_THREADING_THREAD_H_ |
OLD | NEW |