17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci#ifndef FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H 177777dab0Sopenharmony_ci#define FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H 187777dab0Sopenharmony_ci 197777dab0Sopenharmony_citypedef enum { 207777dab0Sopenharmony_ci napi_qos_background = 0, 217777dab0Sopenharmony_ci napi_qos_utility = 1, 227777dab0Sopenharmony_ci napi_qos_default = 2, 237777dab0Sopenharmony_ci napi_qos_user_initiated = 3, 247777dab0Sopenharmony_ci} napi_qos_t; 257777dab0Sopenharmony_ci 267777dab0Sopenharmony_ci/** 277777dab0Sopenharmony_ci * @brief Indicates the running mode of the native event loop in an asynchronous native thread. 287777dab0Sopenharmony_ci * 297777dab0Sopenharmony_ci * @since 12 307777dab0Sopenharmony_ci */ 317777dab0Sopenharmony_citypedef enum { 327777dab0Sopenharmony_ci /** 337777dab0Sopenharmony_ci * In this mode, the current asynchronous thread will be blocked and events of native event loop will 347777dab0Sopenharmony_ci * be processed. 357777dab0Sopenharmony_ci */ 367777dab0Sopenharmony_ci napi_event_mode_default = 0, 377777dab0Sopenharmony_ci 387777dab0Sopenharmony_ci /** 397777dab0Sopenharmony_ci * In this mode, the current asynchronous thread will not be blocked. If there are events in the event loop, 407777dab0Sopenharmony_ci * only one event will be processed and then the event loop will stop. If there are no events in the loop, 417777dab0Sopenharmony_ci * the event loop will stop immediately. 427777dab0Sopenharmony_ci */ 437777dab0Sopenharmony_ci napi_event_mode_nowait = 1, 447777dab0Sopenharmony_ci} napi_event_mode; 457777dab0Sopenharmony_ci 467777dab0Sopenharmony_ci/** 477777dab0Sopenharmony_ci * @brief Indicates the priority of a task dispatched from native thread to ArkTS thread. 487777dab0Sopenharmony_ci * 497777dab0Sopenharmony_ci * @since 12 507777dab0Sopenharmony_ci */ 517777dab0Sopenharmony_citypedef enum { 527777dab0Sopenharmony_ci /** 537777dab0Sopenharmony_ci * The immediate priority tasks should be promptly processed whenever feasible. 547777dab0Sopenharmony_ci */ 557777dab0Sopenharmony_ci napi_priority_immediate = 0, 567777dab0Sopenharmony_ci /** 577777dab0Sopenharmony_ci * The high priority tasks, as sorted by their handle time, should be prioritized over tasks with low priority. 587777dab0Sopenharmony_ci */ 597777dab0Sopenharmony_ci napi_priority_high = 1, 607777dab0Sopenharmony_ci /** 617777dab0Sopenharmony_ci * The low priority tasks, as sorted by their handle time, should be processed before idle priority tasks. 627777dab0Sopenharmony_ci */ 637777dab0Sopenharmony_ci napi_priority_low = 2, 647777dab0Sopenharmony_ci /** 657777dab0Sopenharmony_ci * The idle priority tasks should be processed immediately only if there are no other priority tasks. 667777dab0Sopenharmony_ci */ 677777dab0Sopenharmony_ci napi_priority_idle = 3, 687777dab0Sopenharmony_ci} napi_task_priority; 697777dab0Sopenharmony_ci 707777dab0Sopenharmony_ci#endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H */