| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "base/task_scheduler/scheduler_lock.h" | 5 #include "base/task_scheduler/scheduler_lock.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 int acquired_; | 49 int acquired_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(BasicLockTestThread); | 51 DISALLOW_COPY_AND_ASSIGN(BasicLockTestThread); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class BasicLockAcquireAndWaitThread : public SimpleThread { | 54 class BasicLockAcquireAndWaitThread : public SimpleThread { |
| 55 public: | 55 public: |
| 56 explicit BasicLockAcquireAndWaitThread(SchedulerLock* lock) | 56 explicit BasicLockAcquireAndWaitThread(SchedulerLock* lock) |
| 57 : SimpleThread("BasicLockAcquireAndWaitThread"), | 57 : SimpleThread("BasicLockAcquireAndWaitThread"), |
| 58 lock_(lock), | 58 lock_(lock), |
| 59 lock_acquire_event_(false, false), | 59 lock_acquire_event_(WaitableEvent::ResetPolicy::AUTOMATIC, |
| 60 main_thread_continue_event_(false, false) {} | 60 WaitableEvent::InitialState::NOT_SIGNALED), |
| 61 main_thread_continue_event_(WaitableEvent::ResetPolicy::AUTOMATIC, |
| 62 WaitableEvent::InitialState::NOT_SIGNALED) { |
| 63 } |
| 61 | 64 |
| 62 void WaitForLockAcquisition() { | 65 void WaitForLockAcquisition() { |
| 63 lock_acquire_event_.Wait(); | 66 lock_acquire_event_.Wait(); |
| 64 } | 67 } |
| 65 | 68 |
| 66 void ContinueMain() { | 69 void ContinueMain() { |
| 67 main_thread_continue_event_.Signal(); | 70 main_thread_continue_event_.Signal(); |
| 68 } | 71 } |
| 69 | 72 |
| 70 private: | 73 private: |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 SchedulerLock lock4; | 287 SchedulerLock lock4; |
| 285 SchedulerLock lock5; | 288 SchedulerLock lock5; |
| 286 }; | 289 }; |
| 287 | 290 |
| 288 EXPECT_DCHECK_DEATH({ LockCycle cycle; }, ""); | 291 EXPECT_DCHECK_DEATH({ LockCycle cycle; }, ""); |
| 289 } | 292 } |
| 290 | 293 |
| 291 } // namespace | 294 } // namespace |
| 292 } // namespace internal | 295 } // namespace internal |
| 293 } // namespace base | 296 } // namespace base |
| OLD | NEW |