Commit ea2cb28e authored by Misha Shneerson's avatar Misha Shneerson Committed by Facebook GitHub Bot

keep asynchronous tasks on the intended thread pool - part I (executors)

Summary:
Today, a continuation of coro or semifuture application handlers will always execute on NORMAL priority thread pool. This is because the effective executor for the task is the `ThreadManager::Impl` and its `add()` implementation does not preserver tasks' priority (which we map into thread pool).

In this change, we wrap each priority/source in a separate keepalive. Generated code is routing either coro or semifuture onto the corresponding keepalive, which is preserved across tasks that do not explicitly specify a target executor.

Reviewed By: andriigrynenko

Differential Revision: D25105971

fbshipit-source-id: 9adaea654b3a099ff4de048026a67bdb588a3c2a
parent f7c36166
...@@ -239,6 +239,13 @@ class Executor { ...@@ -239,6 +239,13 @@ class Executor {
return keepAlive.storage_ & KeepAlive<ExecutorT>::kDummyFlag; return keepAlive.storage_ & KeepAlive<ExecutorT>::kDummyFlag;
} }
static bool keepAliveAcquire(Executor* executor) {
return executor->keepAliveAcquire();
}
static void keepAliveRelease(Executor* executor) {
return executor->keepAliveRelease();
}
// Acquire a keep alive token. Should return false if keep-alive mechanism // Acquire a keep alive token. Should return false if keep-alive mechanism
// is not supported. // is not supported.
virtual bool keepAliveAcquire() noexcept; virtual bool keepAliveAcquire() noexcept;
......
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