Thread Observer
[folly.git] / folly / wangle / concurrent / CPUThreadPoolExecutor.cpp
index a03c6151040e240b76ab8f71ced395ff59ba9389..e0ad08c83ce8a76379a147a5a52c0206ed8872d1 100644 (file)
@@ -105,6 +105,10 @@ void CPUThreadPoolExecutor::threadRun(std::shared_ptr<Thread> thread) {
     auto task = taskQueue_->take();
     if (UNLIKELY(task.poison)) {
       CHECK(threadsToStop_-- > 0);
+      for (auto& o : observers_) {
+        o->threadStopped(thread.get());
+      }
+
       stoppedThreads_.add(thread);
       return;
     } else {