Ensure iomgr does not track Forkable threads (#30572)

* Ensure iomgr does not track Forkable threads

New uses of grpc_core::Thread should not be tracked by iomgr. It would
be nice to enforce this, but that can come later. This should unblock
python releases.

* tell parent & child that forking is complete
pull/30585/head
AJ Heller 2 years ago committed by GitHub
parent a9f3ccdeda
commit 37800b2906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/core/lib/event_engine/posix_engine/timer_manager.cc
  2. 2
      src/core/lib/event_engine/thread_pool.cc

@ -62,8 +62,9 @@ void TimerManager::StartThread() {
++thread_count_;
auto* thread = new RunThreadArgs();
thread->self = this;
thread->thread =
grpc_core::Thread("timer_manager", &TimerManager::RunThread, thread);
thread->thread = grpc_core::Thread(
"timer_manager", &TimerManager::RunThread, thread, nullptr,
grpc_core::Thread::Options().set_tracked(false));
thread->thread.Start();
}
@ -273,6 +274,7 @@ void TimerManager::PostforkParent() {
StartThread();
}
prefork_thread_count_ = 0;
forking_ = false;
}
void TimerManager::PostforkChild() {
@ -281,6 +283,7 @@ void TimerManager::PostforkChild() {
StartThread();
}
prefork_thread_count_ = 0;
forking_ = false;
}
} // namespace posix_engine

@ -32,7 +32,7 @@ ThreadPool::Thread::Thread(ThreadPool* pool)
thd_(
"posix_eventengine_pool",
[](void* th) { static_cast<ThreadPool::Thread*>(th)->ThreadFunc(); },
this) {
this, nullptr, grpc_core::Thread::Options().set_tracked(false)) {
thd_.Start();
}
ThreadPool::Thread::~Thread() { thd_.Join(); }

Loading…
Cancel
Save