Commit dff3d40c authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook GitHub Bot

InlineLikeExecutor

Summary: Tag all inline-like executors, so that there's a single way to detect them in places where we don't want inline executors.

Differential Revision: D26564118

fbshipit-source-id: 1a55c03bee0a0a56328175c016d3880a86eab8b1
parent 0bdb2b67
......@@ -26,6 +26,7 @@
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/executors/IOExecutor.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/executors/InlineExecutor.h>
#include <folly/system/HardwareConcurrency.h>
using namespace folly;
......@@ -35,7 +36,7 @@ namespace {
class GlobalTag {};
// aka InlineExecutor
class DefaultCPUExecutor : public Executor {
class DefaultCPUExecutor : public InlineLikeExecutor {
public:
FOLLY_NOINLINE void add(Func f) override { f(); }
};
......@@ -138,9 +139,6 @@ namespace detail {
std::shared_ptr<Executor> tryGetImmutableCPUPtr() {
return getImmutable<Executor>();
}
bool isDefaultExecutor(Executor* ex) {
return dynamic_cast<DefaultCPUExecutor*>(ex);
}
} // namespace detail
Executor::KeepAlive<> getGlobalCPUExecutor() {
......
......@@ -25,7 +25,6 @@ namespace folly {
namespace detail {
std::shared_ptr<Executor> tryGetImmutableCPUPtr();
bool isDefaultExecutor(Executor*);
} // namespace detail
/**
......
......@@ -24,10 +24,15 @@
namespace folly {
class InlineLikeExecutor : public virtual Executor {
public:
virtual ~InlineLikeExecutor() {}
};
/// When work is "queued", execute it immediately inline.
/// Usually when you think you want this, you actually want a
/// QueuedImmediateExecutor.
class InlineExecutor : public Executor {
class InlineExecutor : public InlineLikeExecutor {
public:
FOLLY_ERASE static InlineExecutor& instance() noexcept {
auto const value = cache.load(std::memory_order_acquire);
......
......@@ -20,6 +20,7 @@
#include <folly/Executor.h>
#include <folly/ThreadLocal.h>
#include <folly/executors/InlineExecutor.h>
namespace folly {
......@@ -28,7 +29,7 @@ namespace folly {
* to this executor by one of its own callbacks will be queued instead of
* executed inline (nested). This is usually better behavior than Inline.
*/
class QueuedImmediateExecutor : public Executor {
class QueuedImmediateExecutor : public InlineLikeExecutor {
public:
static QueuedImmediateExecutor& instance();
......
......@@ -35,8 +35,6 @@
namespace folly {
class InlineExecutor;
namespace coro {
namespace detail {
......
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