| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 stop_event_.Set(); | 172 stop_event_.Set(); |
| 173 RTC_CHECK_EQ(0, pthread_join(thread_, nullptr)); | 173 RTC_CHECK_EQ(0, pthread_join(thread_, nullptr)); |
| 174 thread_ = 0; | 174 thread_ = 0; |
| 175 #endif // defined(WEBRTC_WIN) | 175 #endif // defined(WEBRTC_WIN) |
| 176 } | 176 } |
| 177 | 177 |
| 178 void PlatformThread::Run() { | 178 void PlatformThread::Run() { |
| 179 if (!name_.empty()) | 179 if (!name_.empty()) |
| 180 rtc::SetCurrentThreadName(name_.c_str()); | 180 rtc::SetCurrentThreadName(name_.c_str()); |
| 181 do { | 181 do { |
| 182 // The interface contract of Start/Stop is that for a successfull call to | 182 // The interface contract of Start/Stop is that for a successful call to |
| 183 // Start, there should be at least one call to the run function. So we | 183 // Start, there should be at least one call to the run function. So we |
| 184 // call the function before checking |stop_|. | 184 // call the function before checking |stop_|. |
| 185 if (!run_function_(obj_)) | 185 if (!run_function_(obj_)) |
| 186 break; | 186 break; |
| 187 #if defined(WEBRTC_WIN) | 187 #if defined(WEBRTC_WIN) |
| 188 // Alertable sleep to permit RaiseFlag to run and update |stop_|. | 188 // Alertable sleep to permit RaiseFlag to run and update |stop_|. |
| 189 SleepEx(0, true); | 189 SleepEx(0, true); |
| 190 } while (!stop_); | 190 } while (!stop_); |
| 191 #else | 191 #else |
| 192 } while (!stop_event_.Wait(0)); | 192 } while (!stop_event_.Wait(0)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 break; | 241 break; |
| 242 case kRealtimePriority: | 242 case kRealtimePriority: |
| 243 param.sched_priority = top_prio; | 243 param.sched_priority = top_prio; |
| 244 break; | 244 break; |
| 245 } | 245 } |
| 246 return pthread_setschedparam(thread_, policy, ¶m) == 0; | 246 return pthread_setschedparam(thread_, policy, ¶m) == 0; |
| 247 #endif // defined(WEBRTC_WIN) | 247 #endif // defined(WEBRTC_WIN) |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace rtc | 250 } // namespace rtc |
| OLD | NEW |