Delete optional Runnable argument to rtc::Thread::Start
Intended to simplify later changes to thread shutdown logic.
Bug: webrtc:10648
Change-Id: I61ba240c0f4b73a0bc6af6a3471804ecb434c41f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137510
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28219}
diff --git a/rtc_base/physical_socket_server_unittest.cc b/rtc_base/physical_socket_server_unittest.cc
index 611fb18..3987a59 100644
--- a/rtc_base/physical_socket_server_unittest.cc
+++ b/rtc_base/physical_socket_server_unittest.cc
@@ -594,21 +594,6 @@
EXPECT_TRUE(ExpectNone());
}
-class RaiseSigTermRunnable : public Runnable {
- void Run(Thread* thread) override {
- thread->socketserver()->Wait(1000, false);
-
- // Allow SIGTERM. This will be the only thread with it not masked so it will
- // be delivered to us.
- sigset_t mask;
- sigemptyset(&mask);
- pthread_sigmask(SIG_SETMASK, &mask, nullptr);
-
- // Raise it.
- raise(SIGTERM);
- }
-};
-
// Test that it works no matter what thread the kernel chooses to give the
// signal to (since it's not guaranteed to be the one that Wait() runs on).
// TODO(webrtc:7864): Fails on real iOS devices
@@ -628,8 +613,19 @@
// thread. Our implementation should safely handle it and dispatch
// RecordSignal() on this thread.
std::unique_ptr<Thread> thread(Thread::CreateWithSocketServer());
- std::unique_ptr<RaiseSigTermRunnable> runnable(new RaiseSigTermRunnable());
- thread->Start(runnable.get());
+ thread->Start();
+ thread->PostTask(RTC_FROM_HERE, [&thread]() {
+ thread->socketserver()->Wait(1000, false);
+ // Allow SIGTERM. This will be the only thread with it not masked so it will
+ // be delivered to us.
+ sigset_t mask;
+ sigemptyset(&mask);
+ pthread_sigmask(SIG_SETMASK, &mask, nullptr);
+
+ // Raise it.
+ raise(SIGTERM);
+ });
+
EXPECT_TRUE(ss_->Wait(1500, true));
EXPECT_TRUE(ExpectSignal(SIGTERM));
EXPECT_EQ(Thread::Current(), signaled_thread_);