diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/logging/backend.cpp | 2 | ||||
-rw-r--r-- | src/common/logging/log.h | 2 | ||||
-rw-r--r-- | src/common/threadsafe_queue.h | 32 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 55de535c0..d86c40d26 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -171,6 +171,7 @@ void FileBackend::Write(const Entry& entry) { SUB(Service, BCAT) \ SUB(Service, BTM) \ SUB(Service, Fatal) \ + SUB(Service, FGM) \ SUB(Service, Friend) \ SUB(Service, FS) \ SUB(Service, HID) \ @@ -185,6 +186,7 @@ void FileBackend::Write(const Entry& entry) { SUB(Service, NIFM) \ SUB(Service, NS) \ SUB(Service, NVDRV) \ + SUB(Service, PCIE) \ SUB(Service, PCTL) \ SUB(Service, PREPO) \ SUB(Service, SET) \ diff --git a/src/common/logging/log.h b/src/common/logging/log.h index e8d98de99..140cd8e47 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -58,6 +58,7 @@ enum class Class : ClassType { Service_BCAT, ///< The BCAT service Service_BTM, ///< The BTM service Service_Fatal, ///< The Fatal service + Service_FGM, ///< The FGM service Service_Friend, ///< The friend service Service_FS, ///< The FS (Filesystem) service Service_HID, ///< The HID (Human interface device) service @@ -72,6 +73,7 @@ enum class Class : ClassType { Service_NIFM, ///< The NIFM (Network interface) service Service_NS, ///< The NS services Service_NVDRV, ///< The NVDRV (Nvidia driver) service + Service_PCIE, ///< The PCIe service Service_PCTL, ///< The PCTL (Parental control) service Service_PREPO, ///< The PREPO (Play report) service Service_SET, ///< The SET (Settings) service diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index a0c731e8c..edf13bc49 100644 --- a/src/common/threadsafe_queue.h +++ b/src/common/threadsafe_queue.h @@ -33,9 +33,11 @@ public: bool Empty() const { return !read_ptr->next.load(); } + T& Front() const { return read_ptr->current; } + template <typename Arg> void Push(Arg&& t) { // create the element, add it to the queue @@ -108,15 +110,41 @@ private: // single reader, multiple writer queue template <typename T, bool NeedSize = true> -class MPSCQueue : public SPSCQueue<T, NeedSize> { +class MPSCQueue { public: + u32 Size() const { + return spsc_queue.Size(); + } + + bool Empty() const { + return spsc_queue.Empty(); + } + + T& Front() const { + return spsc_queue.Front(); + } + template <typename Arg> void Push(Arg&& t) { std::lock_guard<std::mutex> lock(write_lock); - SPSCQueue<T, NeedSize>::Push(t); + spsc_queue.Push(t); + } + + void Pop() { + return spsc_queue.Pop(); + } + + bool Pop(T& t) { + return spsc_queue.Pop(t); + } + + // not thread-safe + void Clear() { + spsc_queue.Clear(); } private: + SPSCQueue<T, NeedSize> spsc_queue; std::mutex write_lock; }; } // namespace Common |