OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H |
| 6 #define BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H |
| 7 |
| 8 #include "base/base_export.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/synchronization/lock.h" |
| 12 |
| 13 namespace base { |
| 14 |
| 15 class ConditionVariable; |
| 16 |
| 17 namespace internal { |
| 18 |
| 19 // A regular lock with simple deadlock correctness checking. |
| 20 // This lock tracks all of the available locks to make sure that any locks are |
| 21 // acquired in an expected order. |
| 22 // See scheduler_lock.h for details. |
| 23 class BASE_EXPORT SchedulerLockImpl { |
| 24 public: |
| 25 SchedulerLockImpl(); |
| 26 explicit SchedulerLockImpl(const SchedulerLockImpl* predecessor); |
| 27 ~SchedulerLockImpl(); |
| 28 |
| 29 void Acquire(); |
| 30 void Release(); |
| 31 |
| 32 void AssertAcquired() const; |
| 33 |
| 34 scoped_ptr<ConditionVariable> CreateConditionVariable(); |
| 35 |
| 36 private: |
| 37 Lock lock_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(SchedulerLockImpl); |
| 40 }; |
| 41 |
| 42 } // namespace internal |
| 43 } // namespace base |
| 44 |
| 45 #endif // BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H |
OLD | NEW |