/* * Copyright (c) 2018 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include "tma_conn_service_ids.hpp" #include "tma_task.hpp" class TmaTaskList { private: mutable HosMutex lock; std::vector tasks[TmaTask::NumPriorities]; std::vector sleeping_tasks[TmaTask::NumPriorities]; private: void Remove(TmaTask *task); TmaTask *GetById(u32 task_id) const; public: TmaTaskList() { } virtual ~TmaTaskList() { } u32 GetNumTasks() const; u32 GetNumSleepingTasks() const; bool SendPacket(bool connected, TmaPacket *packet); bool ReceivePacket(TmaPacket *packet); void Add(TmaTask *task); void Cancel(u32 task_id); void CancelAll(); void Sleep(); void Wake(); };