| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 PlatformThread::PlatformThread(ThreadRunFunction func, | 94 PlatformThread::PlatformThread(ThreadRunFunction func, |
| 95 void* obj, | 95 void* obj, |
| 96 const char* thread_name) | 96 const char* thread_name) |
| 97 : run_function_(func), | 97 : run_function_(func), |
| 98 obj_(obj), | 98 obj_(obj), |
| 99 name_(thread_name ? thread_name : "webrtc"), | 99 name_(thread_name ? thread_name : "webrtc"), |
| 100 #if defined(WEBRTC_WIN) | 100 #if defined(WEBRTC_WIN) |
| 101 stop_(false), | 101 stop_(false), |
| 102 thread_(NULL), | 102 thread_(nullptr), |
| 103 thread_id_(0) { | 103 thread_id_(0) { |
| 104 #else | 104 #else |
| 105 stop_event_(false, false), | 105 stop_event_(false, false), |
| 106 thread_(0) { | 106 thread_(0) { |
| 107 #endif // defined(WEBRTC_WIN) | 107 #endif // defined(WEBRTC_WIN) |
| 108 RTC_DCHECK(func); | 108 RTC_DCHECK(func); |
| 109 RTC_DCHECK(name_.length() < 64); | 109 RTC_DCHECK(name_.length() < 64); |
| 110 } | 110 } |
| 111 | 111 |
| 112 PlatformThread::~PlatformThread() { | 112 PlatformThread::~PlatformThread() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 136 | 136 |
| 137 void PlatformThread::Start() { | 137 void PlatformThread::Start() { |
| 138 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 138 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 139 RTC_DCHECK(!thread_) << "Thread already started?"; | 139 RTC_DCHECK(!thread_) << "Thread already started?"; |
| 140 #if defined(WEBRTC_WIN) | 140 #if defined(WEBRTC_WIN) |
| 141 stop_ = false; | 141 stop_ = false; |
| 142 | 142 |
| 143 // See bug 2902 for background on STACK_SIZE_PARAM_IS_A_RESERVATION. | 143 // See bug 2902 for background on STACK_SIZE_PARAM_IS_A_RESERVATION. |
| 144 // Set the reserved stack stack size to 1M, which is the default on Windows | 144 // Set the reserved stack stack size to 1M, which is the default on Windows |
| 145 // and Linux. | 145 // and Linux. |
| 146 thread_ = ::CreateThread(NULL, 1024 * 1024, &StartThread, this, | 146 thread_ = ::CreateThread(nullptr, 1024 * 1024, &StartThread, this, |
| 147 STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id_); | 147 STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id_); |
| 148 RTC_CHECK(thread_) << "CreateThread failed"; | 148 RTC_CHECK(thread_) << "CreateThread failed"; |
| 149 RTC_DCHECK(thread_id_); | 149 RTC_DCHECK(thread_id_); |
| 150 #else | 150 #else |
| 151 ThreadAttributes attr; | 151 ThreadAttributes attr; |
| 152 // Set the stack stack size to 1M. | 152 // Set the stack stack size to 1M. |
| 153 pthread_attr_setstacksize(&attr, 1024 * 1024); | 153 pthread_attr_setstacksize(&attr, 1024 * 1024); |
| 154 RTC_CHECK_EQ(0, pthread_create(&thread_, &attr, &StartThread, this)); | 154 RTC_CHECK_EQ(0, pthread_create(&thread_, &attr, &StartThread, this)); |
| 155 #endif // defined(WEBRTC_WIN) | 155 #endif // defined(WEBRTC_WIN) |
| 156 } | 156 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 #if defined(WEBRTC_WIN) | 268 #if defined(WEBRTC_WIN) |
| 269 bool PlatformThread::QueueAPC(PAPCFUNC function, ULONG_PTR data) { | 269 bool PlatformThread::QueueAPC(PAPCFUNC function, ULONG_PTR data) { |
| 270 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 270 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 271 RTC_DCHECK(IsRunning()); | 271 RTC_DCHECK(IsRunning()); |
| 272 | 272 |
| 273 return QueueUserAPC(function, thread_, data) != FALSE; | 273 return QueueUserAPC(function, thread_, data) != FALSE; |
| 274 } | 274 } |
| 275 #endif | 275 #endif |
| 276 | 276 |
| 277 } // namespace rtc | 277 } // namespace rtc |
| OLD | NEW |