1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#ifndef FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H 17#define FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H 18 19typedef enum { 20 napi_qos_background = 0, 21 napi_qos_utility = 1, 22 napi_qos_default = 2, 23 napi_qos_user_initiated = 3, 24} napi_qos_t; 25 26/** 27 * @brief Indicates the running mode of the native event loop in an asynchronous native thread. 28 * 29 * @since 12 30 */ 31typedef enum { 32 /** 33 * In this mode, the current asynchronous thread will be blocked and events of native event loop will 34 * be processed. 35 */ 36 napi_event_mode_default = 0, 37 38 /** 39 * In this mode, the current asynchronous thread will not be blocked. If there are events in the event loop, 40 * only one event will be processed and then the event loop will stop. If there are no events in the loop, 41 * the event loop will stop immediately. 42 */ 43 napi_event_mode_nowait = 1, 44} napi_event_mode; 45 46/** 47 * @brief Indicates the priority of a task dispatched from native thread to ArkTS thread. 48 * 49 * @since 12 50 */ 51typedef enum { 52 /** 53 * The immediate priority tasks should be promptly processed whenever feasible. 54 */ 55 napi_priority_immediate = 0, 56 /** 57 * The high priority tasks, as sorted by their handle time, should be prioritized over tasks with low priority. 58 */ 59 napi_priority_high = 1, 60 /** 61 * The low priority tasks, as sorted by their handle time, should be processed before idle priority tasks. 62 */ 63 napi_priority_low = 2, 64 /** 65 * The idle priority tasks should be processed immediately only if there are no other priority tasks. 66 */ 67 napi_priority_idle = 3, 68} napi_task_priority; 69 70#endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H */