PlatformThread: add support for detached threads.

The change introduces support for detachable PlatformThreads, for which
the Stop() call doesn't wait until the thread has finished executing.

The change also introduces rtc::ThreadAttributes that carries priority
and detachability thread attributes. It additionally refactors all
known use to use the new semantics.

Bug: b:181572711, webrtc:12659
Change-Id: Id96e87c2a0dafabc8047767d241fd5da4505d14c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214704
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33796}
This commit is contained in:
Markus Handell
2021-04-20 17:41:54 +02:00
committed by Commit Bot
parent 6ef4af9546
commit 97c4458c8f
18 changed files with 278 additions and 182 deletions

View File

@ -429,15 +429,21 @@ class AudioCodingModuleMtTestOldApi : public AudioCodingModuleTestOldApi {
AudioCodingModuleMtTestOldApi()
: AudioCodingModuleTestOldApi(),
send_thread_(CbSendThread, this, "send", rtc::kRealtimePriority),
insert_packet_thread_(CbInsertPacketThread,
this,
"insert_packet",
rtc::kRealtimePriority),
pull_audio_thread_(CbPullAudioThread,
this,
"pull_audio",
rtc::kRealtimePriority),
send_thread_(
CbSendThread,
this,
"send",
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)),
insert_packet_thread_(
CbInsertPacketThread,
this,
"insert_packet",
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)),
pull_audio_thread_(
CbPullAudioThread,
this,
"pull_audio",
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)),
send_count_(0),
insert_packet_count_(0),
pull_audio_count_(0),
@ -693,14 +699,16 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
AcmReRegisterIsacMtTestOldApi()
: AudioCodingModuleTestOldApi(),
receive_thread_(CbReceiveThread,
this,
"receive",
rtc::kRealtimePriority),
codec_registration_thread_(CbCodecRegistrationThread,
this,
"codec_registration",
rtc::kRealtimePriority),
receive_thread_(
CbReceiveThread,
this,
"receive",
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)),
codec_registration_thread_(
CbCodecRegistrationThread,
this,
"codec_registration",
rtc::ThreadAttributes().SetPriority(rtc::kRealtimePriority)),
codec_registered_(false),
receive_packet_count_(0),
next_insert_packet_time_ms_(0),