Commit 560befd3 authored by Rodolfo Granata's avatar Rodolfo Granata Committed by Facebook Github Bot

ThreadPoolExecutor: throw in getPendingTaskCountImpl instead of pure virtual.

Summary:
Calling `folly::ThreadPoolExecutor::withAll` is powerfull when combined with `folly::ThreadPoolExecutor::getPoolStats`.
However getPendingTaskCountImpl being pure virtual can trigger `__cxa_pure_virtual ... std::terminate()` while object is partially destructed.

This change signals implementors of derived clases to write a body for getPendingTaskCountImpl while allowing calling getPoolStats -> getPendingTaskCountImpl within a try/catch block.

Reviewed By: yfeldblum

Differential Revision: D17915523

fbshipit-source-id: 2ffad7076313407969d88c75c7e457fa4e7e2d6d
parent 626871c3
......@@ -225,7 +225,9 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor {
}
// Prerequisite: threadListLock_ readlocked or writelocked
virtual size_t getPendingTaskCountImpl() const = 0;
virtual size_t getPendingTaskCountImpl() const {
throw std::logic_error("getPendingTaskCountImpl not implemented");
}
class ThreadList {
public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment