From e78bd11a05d23d8f6734c7c9d50aa707578d3b24 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sat, 16 Jun 2018 17:10:41 +0200 Subject: [PATCH] Stratosphere: Simplify initialization --- .../include/stratosphere/waitablemanager.hpp | 6 +++--- .../include/stratosphere/waitablemanagerbase.hpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stratosphere/libstratosphere/include/stratosphere/waitablemanager.hpp b/stratosphere/libstratosphere/include/stratosphere/waitablemanager.hpp index 13899697a..4b42cd2cd 100644 --- a/stratosphere/libstratosphere/include/stratosphere/waitablemanager.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/waitablemanager.hpp @@ -14,13 +14,13 @@ class WaitableManager : public WaitableManagerBase { protected: std::vector to_add_waitables; std::vector waitables; - u64 timeout; + u64 timeout = 0; HosMutex lock; - std::atomic_bool has_new_items; + std::atomic_bool has_new_items = false; private: void process_internal(bool break_on_timeout); public: - WaitableManager(u64 t) : waitables(0), timeout(t), has_new_items(false) { } + WaitableManager(u64 t) : timeout(t) { } ~WaitableManager() override { /* This should call the destructor for every waitable. */ std::for_each(waitables.begin(), waitables.end(), std::default_delete{}); diff --git a/stratosphere/libstratosphere/include/stratosphere/waitablemanagerbase.hpp b/stratosphere/libstratosphere/include/stratosphere/waitablemanagerbase.hpp index 972710064..ed4c7775a 100644 --- a/stratosphere/libstratosphere/include/stratosphere/waitablemanagerbase.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/waitablemanagerbase.hpp @@ -4,12 +4,12 @@ #include class WaitableManagerBase { - std::atomic cur_priority; + std::atomic cur_priority = 0; public: - WaitableManagerBase() : cur_priority(0) { } - virtual ~WaitableManagerBase() { } - - u64 get_priority() { + WaitableManagerBase() = default; + virtual ~WaitableManagerBase() = default; + + u64 get_priority() { return std::atomic_fetch_add(&cur_priority, (u64)1); } -}; \ No newline at end of file +};