Skip to content

Commit 8b2afb1

Browse files
committed
Update
[ghstack-poisoned]
1 parent 2e8e579 commit 8b2afb1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/portable/executor_runner/executor_runner.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
#if defined(ET_USE_THREADPOOL)
4242
#include <executorch/extension/threadpool/cpuinfo_utils.h>
4343
#include <executorch/extension/threadpool/threadpool.h>
44+
#include <executorch/extension/threadpool/threadpool_guard.h>
45+
46+
#include <optional>
4447
#endif
4548

4649
static uint8_t method_allocator_pool[4 * 1024U * 1024U]; // 4 MB
@@ -163,6 +166,11 @@ int main(int argc, char** argv) {
163166
::executorch::extension::threadpool::get_threadpool()
164167
->_unsafe_reset_threadpool(num_performant_cores);
165168
}
169+
std::optional<::executorch::extension::threadpool::NoThreadPoolGuard>
170+
opt_guard;
171+
if (cpu_threads == 1) {
172+
opt_guard.emplace();
173+
}
166174
#endif // ET_USE_THREADPOOL
167175
// Create a loader to get the data of the program file. There are other
168176
// DataLoaders that use mmap() or point to data that's already in memory, and

0 commit comments

Comments
 (0)