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 #include "sched/qos.h" 21 #include "c/executor_task.h" 22 23 namespace ffrt { 24 typedef struct { 25 ffrt_coroutine_ptr_t exec; 26 ffrt_function_t destroy; 27 void* data; 28 } ffrt_io_callable_t; 29 30 struct IOTaskExecutor: public ffrt_executor_task { IOTaskExecutorffrt::IOTaskExecutor31 IOTaskExecutor(const QoS &qos) : qos(qos) 32 { 33 type = ffrt_io_task; 34 work = {nullptr, nullptr, nullptr}; 35 } 36 37 QoS qos; 38 ffrt_io_callable_t work; 39 ExecTaskStatus status = ExecTaskStatus::ET_PENDING; 40 }; 41 } /* namespace ffrt */ 42 #endif