From bd6873be3a870103ce53411974e18f9a64f45218 Mon Sep 17 00:00:00 2001 From: Shivanshu Arora Date: Tue, 19 Sep 2023 20:00:59 -0700 Subject: [PATCH] Improve Folly thread pool executor documentation for running task Summary: The expire Callback is not intuitive to understand that it means if the task waittime has expired or the task is running for more than the expiration time So adding a comment Reviewed By: Gownta Differential Revision: D49432292 fbshipit-source-id: e95cd1b589745f0e1145c7b0184c4bc0f49c3a43 --- folly/executors/ThreadPoolExecutor.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/folly/executors/ThreadPoolExecutor.h b/folly/executors/ThreadPoolExecutor.h index c0ccf2994a4..8e2bb7ab8fa 100644 --- a/folly/executors/ThreadPoolExecutor.h +++ b/folly/executors/ThreadPoolExecutor.h @@ -74,6 +74,14 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor { ~ThreadPoolExecutor() override; void add(Func func) override = 0; + /** + * If func doesn't get started within expiration time after its enqueued, + * expireCallback will be run + * + * @param func Main function to be executed + * @param expiration Maximum time to wait for func to start execution + * @param expireCallback If expiration limit is reached, execute this callback + */ virtual void add( Func func, std::chrono::milliseconds expiration, Func expireCallback);