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_TASK_IO_H 17 #define FFRT_TASK_IO_H 18 19 #include "internal_inc/types.h" 20 #ifdef USE_OHOS_QOS 21 #include "qos.h" 22 #else 23 #include "staging_qos/sched/qos.h" 24 #endif 25 #include "c/executor_task.h" 26 27 namespace ffrt { 28 typedef struct { 29 ffrt_coroutine_ptr_t exec; 30 ffrt_function_t destroy; 31 void* data; 32 } ffrt_io_callable_t; 33 34 struct IOTaskExecutor: public ffrt_executor_task { IOTaskExecutorIOTaskExecutor35 IOTaskExecutor(const QoS &qos) : qos(qos) 36 { 37 type = ffrt_io_task; 38 work = {nullptr, nullptr, nullptr}; 39 } 40 41 QoS qos; 42 ffrt_io_callable_t work; 43 ExecTaskStatus status = ExecTaskStatus::ET_PENDING; 44 }; 45 } /* namespace ffrt */ 46 #endif