folly
folly copied to clipboard
how to tell whether the current thread is an folly::executor thread or not?
a general folly::executor question, is there a way to tell whether the current thread is an folly::executor thread or not? For example, something like an API static folly::Executor* folly::executor::getExecutor(), which returns a nullptr if current thread is not an executor thread.
You may want to use thread_local
variables to tell if we are in some special executor's thread.
https://github.com/facebook/folly/blob/main/folly/executors/IOThreadPoolExecutor.h#L136
This is not currently a facility supported by folly executors. In particular, in any given thread, there may be multiple executors at once.