kern: devirtualize KReadableEvent::Reset, KWorkerTask::DoWorkerTask

This commit is contained in:
Michael Scire
2021-10-24 20:41:38 -07:00
parent fd187f952e
commit 54dde406bc
12 changed files with 62 additions and 24 deletions

View File

@@ -18,16 +18,23 @@
namespace ams::kern {
class KWorkerTask {
/* NOTE: We inherit KWorkerTask from KSynchronizationObject in order to devirtualize DoWorkerTask, which is exclusive to KThread/KProcess. */
/* This should be reverted, if Nintendo adds new types of worker tasks in the future. */
/* Nintendo has class KWorkerTask { ... } with identical interface but DoWorkerTask() virtual. */
class KWorkerTask : public KSynchronizationObject {
private:
KWorkerTask *m_next_task;
public:
constexpr ALWAYS_INLINE KWorkerTask() : m_next_task(nullptr) { /* ... */ }
constexpr ALWAYS_INLINE explicit KWorkerTask(util::ConstantInitializeTag) : KSynchronizationObject(util::ConstantInitialize), m_next_task(nullptr) { /* ... */ }
ALWAYS_INLINE explicit KWorkerTask() : m_next_task(nullptr) { /* ... */ }
constexpr ALWAYS_INLINE KWorkerTask *GetNextTask() const { return m_next_task; }
constexpr ALWAYS_INLINE void SetNextTask(KWorkerTask *task) { m_next_task = task; }
virtual void DoWorkerTask() = 0;
void DoWorkerTask();
};
}