============================================================================================== class IoTask ============================================================================================== @class IoTask. @brief Long running or blocking task running in the IO thread pool. @note For internal use only.
| 32 | /// @brief Long running or blocking task running in the IO thread pool. |
| 33 | /// @note For internal use only. |
| 34 | class IoTask : public ITask |
| 35 | { |
| 36 | public: |
| 37 | using Ptr = std::shared_ptr<IoTask>; |
| 38 | using WeakPtr = std::weak_ptr<IoTask>; |
| 39 | |
| 40 | template <class RET, class FUNC, class ... ARGS> |
| 41 | IoTask(std::true_type, |
| 42 | std::shared_ptr<Promise<RET>> promise, |
| 43 | int queueId, |
| 44 | bool isHighPriority, |
| 45 | FUNC&& func, |
| 46 | ARGS&&... args); |
| 47 | |
| 48 | template <class RET, class FUNC, class ... ARGS> |
| 49 | IoTask(std::false_type, |
| 50 | std::shared_ptr<Promise<RET>> promise, |
| 51 | int queueId, |
| 52 | bool isHighPriority, |
| 53 | FUNC&& func, |
| 54 | ARGS&&... args); |
| 55 | |
| 56 | IoTask(const IoTask& task) = delete; |
| 57 | IoTask(IoTask&& task) = default; |
| 58 | IoTask& operator=(const IoTask& task) = delete; |
| 59 | IoTask& operator=(IoTask&& task) = default; |
| 60 | |
| 61 | ~IoTask(); |
| 62 | |
| 63 | //ITerminate |
| 64 | void terminate() final; |
| 65 | |
| 66 | //ITask |
| 67 | int run() final; |
| 68 | void setQueueId(int queueId) final; |
| 69 | int getQueueId() const final; |
| 70 | Type getType() const final; |
| 71 | TaskId getTaskId() const final; |
| 72 | bool isBlocked() const final; |
| 73 | bool isSleeping(bool updateTimer = false) final; |
| 74 | bool isHighPriority() const final; |
| 75 | bool isSuspended() const final; |
| 76 | ITask::LocalStorage& getLocalStorage() final; |
| 77 | |
| 78 | //=================================== |
| 79 | // NEW / DELETE |
| 80 | //=================================== |
| 81 | static void* operator new(size_t size); |
| 82 | static void operator delete(void* p); |
| 83 | static void deleter(IoTask* p); |
| 84 | |
| 85 | private: |
| 86 | Function<int()> _func; //the current runnable io function |
| 87 | std::atomic_bool _terminated; |
| 88 | int _queueId; |
| 89 | bool _isHighPriority; |
| 90 | TaskId _taskId; |
| 91 | ITask::LocalStorage _localStorage; // local storage of the IO task |
nothing calls this directly
no outgoing calls
no test coverage detected