diff --git a/examples/portable/executor_runner/executor_runner.cpp b/examples/portable/executor_runner/executor_runner.cpp index 0974e751203..1157554c050 100644 --- a/examples/portable/executor_runner/executor_runner.cpp +++ b/examples/portable/executor_runner/executor_runner.cpp @@ -41,6 +41,9 @@ #if defined(ET_USE_THREADPOOL) #include #include +#include + +#include #endif static uint8_t method_allocator_pool[4 * 1024U * 1024U]; // 4 MB @@ -163,6 +166,11 @@ int main(int argc, char** argv) { ::executorch::extension::threadpool::get_threadpool() ->_unsafe_reset_threadpool(num_performant_cores); } + std::optional<::executorch::extension::threadpool::NoThreadPoolGuard> + opt_guard; + if (cpu_threads == 1) { + opt_guard.emplace(); + } #endif // ET_USE_THREADPOOL // Create a loader to get the data of the program file. There are other // DataLoaders that use mmap() or point to data that's already in memory, and