OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 return false; | 107 return false; |
108 } | 108 } |
109 | 109 |
110 int threads_active_; | 110 int threads_active_; |
111 Event start_event_; | 111 Event start_event_; |
112 Event done_event_; | 112 Event done_event_; |
113 int shared_value_; | 113 int shared_value_; |
114 }; | 114 }; |
115 | 115 |
116 class RTC_LOCKABLE CriticalSectionLock { | 116 class LOCKABLE CriticalSectionLock { |
117 public: | 117 public: |
118 void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { cs_.Enter(); } | 118 void Lock() EXCLUSIVE_LOCK_FUNCTION() { |
119 void Unlock() RTC_UNLOCK_FUNCTION() { cs_.Leave(); } | 119 cs_.Enter(); |
| 120 } |
| 121 void Unlock() UNLOCK_FUNCTION() { |
| 122 cs_.Leave(); |
| 123 } |
120 | 124 |
121 private: | 125 private: |
122 CriticalSection cs_; | 126 CriticalSection cs_; |
123 }; | 127 }; |
124 | 128 |
125 template <class Lock> | 129 template <class Lock> |
126 class LockRunner : public RunnerBase { | 130 class LockRunner : public RunnerBase { |
127 public: | 131 public: |
128 LockRunner() : RunnerBase(0) {} | 132 LockRunner() : RunnerBase(0) {} |
129 | 133 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 for (auto& t : threads) | 404 for (auto& t : threads) |
401 t.Start(&test_data, kThreadRepeats, 1); | 405 t.Start(&test_data, kThreadRepeats, 1); |
402 | 406 |
403 event.Wait(Event::kForever); | 407 event.Wait(Event::kForever); |
404 | 408 |
405 for (auto& t : threads) | 409 for (auto& t : threads) |
406 t.Stop(); | 410 t.Stop(); |
407 } | 411 } |
408 | 412 |
409 } // namespace rtc | 413 } // namespace rtc |
OLD | NEW |