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 LOCKABLE CriticalSectionLock { | 116 class RTC_LOCKABLE CriticalSectionLock { |
117 public: | 117 public: |
118 void Lock() EXCLUSIVE_LOCK_FUNCTION() { | 118 void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { cs_.Enter(); } |
119 cs_.Enter(); | 119 void Unlock() RTC_UNLOCK_FUNCTION() { cs_.Leave(); } |
120 } | |
121 void Unlock() UNLOCK_FUNCTION() { | |
122 cs_.Leave(); | |
123 } | |
124 | 120 |
125 private: | 121 private: |
126 CriticalSection cs_; | 122 CriticalSection cs_; |
127 }; | 123 }; |
128 | 124 |
129 template <class Lock> | 125 template <class Lock> |
130 class LockRunner : public RunnerBase { | 126 class LockRunner : public RunnerBase { |
131 public: | 127 public: |
132 LockRunner() : RunnerBase(0) {} | 128 LockRunner() : RunnerBase(0) {} |
133 | 129 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 for (auto& t : threads) | 400 for (auto& t : threads) |
405 t.Start(&test_data, kThreadRepeats, 1); | 401 t.Start(&test_data, kThreadRepeats, 1); |
406 | 402 |
407 event.Wait(Event::kForever); | 403 event.Wait(Event::kForever); |
408 | 404 |
409 for (auto& t : threads) | 405 for (auto& t : threads) |
410 t.Stop(); | 406 t.Stop(); |
411 } | 407 } |
412 | 408 |
413 } // namespace rtc | 409 } // namespace rtc |
OLD | NEW |