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 FFRT_INNER_API_C_TASK_H 17 #define FFRT_INNER_API_C_TASK_H 18 #include <stdint.h> 19 #include <stdbool.h> 20 #include "type_def_ext.h" 21 22 /** 23 * @brief Skips a task. 24 * 25 * @param handle Indicates a task handle. 26 * @return Returns <b>0</b> if the task is skipped; 27 returns <b>-1</b> otherwise. 28 * @since 10 29 * @version 1.0 30 */ 31 FFRT_C_API int ffrt_skip(ffrt_task_handle_t handle); 32 33 // config 34 FFRT_C_API int ffrt_set_cgroup_attr(ffrt_qos_t qos, ffrt_os_sched_attr* attr); 35 FFRT_C_API void ffrt_restore_qos_config(void); 36 FFRT_C_API int ffrt_set_cpu_worker_max_num(ffrt_qos_t qos, uint32_t num); 37 38 /** 39 * @brief Sets whether the task notifies worker, only support for normal task. 40 * 41 * @param attr Indicates a pointer to the task attribute. 42 * @param notify Indicates whether the task notifies worker. 43 * @version 1.0 44 */ 45 FFRT_C_API void ffrt_task_attr_set_notify_worker(ffrt_task_attr_t* attr, bool notify); 46 47 /** 48 * @brief Notifies a specified number of workers at a specified QoS level. 49 * 50 * @param qos Indicates the QoS. 51 * @param number Indicates the number of workers to be notified. 52 * @version 1.0 53 */ 54 FFRT_C_API void ffrt_notify_workers(ffrt_qos_t qos, int number); 55 56 /** 57 * @brief Obtains the ID of this queue. 58 * 59 * @return Returns the queue ID. 60 * @version 1.0 61 */ 62 FFRT_C_API int64_t ffrt_this_queue_get_id(void); 63 #endif 64