xref: /aosp_15_r20/external/executorch/extension/threadpool/threadpool_guard.cpp (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #include <executorch/extension/threadpool/threadpool_guard.h>
10 
11 namespace executorch::extension::threadpool {
12 
13 thread_local bool NoThreadPoolGuard_enabled = false;
14 
is_enabled()15 bool NoThreadPoolGuard::is_enabled() {
16   return NoThreadPoolGuard_enabled;
17 }
18 
set_enabled(bool enabled)19 void NoThreadPoolGuard::set_enabled(bool enabled) {
20   NoThreadPoolGuard_enabled = enabled;
21 }
22 
23 } // namespace executorch::extension::threadpool
24