OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 { | 346 { |
347 CritScope cs(&crit_); | 347 CritScope cs(&crit_); |
348 _SendMessage smsg; | 348 _SendMessage smsg; |
349 smsg.thread = current_thread; | 349 smsg.thread = current_thread; |
350 smsg.msg = msg; | 350 smsg.msg = msg; |
351 smsg.ready = &ready; | 351 smsg.ready = &ready; |
352 sendlist_.push_back(smsg); | 352 sendlist_.push_back(smsg); |
353 } | 353 } |
354 | 354 |
355 // Wait for a reply | 355 // Wait for a reply |
356 | 356 { |
357 ss_->WakeUp(); | 357 SharedScope ss(&ss_lock_); |
358 ss_->WakeUp(); | |
pthatcher1
2016/02/12 00:16:33
Instead of making ss_lock_ protected, could we jus
joachim
2016/02/12 15:09:52
That would still be racy imho because the variable
| |
359 } | |
358 | 360 |
359 bool waited = false; | 361 bool waited = false; |
360 crit_.Enter(); | 362 crit_.Enter(); |
361 while (!ready) { | 363 while (!ready) { |
362 crit_.Leave(); | 364 crit_.Leave(); |
363 // We need to limit "ReceiveSends" to |this| thread to avoid an arbitrary | 365 // We need to limit "ReceiveSends" to |this| thread to avoid an arbitrary |
364 // thread invoking calls on the current thread. | 366 // thread invoking calls on the current thread. |
365 current_thread->ReceiveSendsFromThread(this); | 367 current_thread->ReceiveSendsFromThread(this); |
366 current_thread->socketserver()->Wait(kForever, false); | 368 current_thread->socketserver()->Wait(kForever, false); |
367 waited = true; | 369 waited = true; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 if (SUCCEEDED(hr)) { | 536 if (SUCCEEDED(hr)) { |
535 Thread::Run(); | 537 Thread::Run(); |
536 CoUninitialize(); | 538 CoUninitialize(); |
537 } else { | 539 } else { |
538 LOG(LS_ERROR) << "CoInitialize failed, hr=" << hr; | 540 LOG(LS_ERROR) << "CoInitialize failed, hr=" << hr; |
539 } | 541 } |
540 } | 542 } |
541 #endif | 543 #endif |
542 | 544 |
543 } // namespace rtc | 545 } // namespace rtc |
OLD | NEW |