From d556a8be08254f96cff81f7d7a0aec673e081160 Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Thu, 28 Jul 2022 16:08:27 -0700 Subject: [PATCH] Add API documentation to MemoryAllocationEvent. --- src/gpgmm/common/MemoryAllocator.h | 5 +++-- src/gpgmm/common/WorkerThread.h | 24 ++++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/gpgmm/common/MemoryAllocator.h b/src/gpgmm/common/MemoryAllocator.h index 53aeb410c..1f856ebda 100644 --- a/src/gpgmm/common/MemoryAllocator.h +++ b/src/gpgmm/common/MemoryAllocator.h @@ -106,8 +106,6 @@ namespace gpgmm { // Event overrides void Wait() override; - bool IsSignaled() override; - void Signal() override; /** \brief Acquire the memory allocation. @@ -116,6 +114,9 @@ namespace gpgmm { std::unique_ptr AcquireAllocation() const; private: + void Signal() override; + bool IsSignaled() override; + std::shared_ptr mTask; std::shared_ptr mEvent; }; diff --git a/src/gpgmm/common/WorkerThread.h b/src/gpgmm/common/WorkerThread.h index 9065f4bcb..17cc1d4af 100644 --- a/src/gpgmm/common/WorkerThread.h +++ b/src/gpgmm/common/WorkerThread.h @@ -31,21 +31,37 @@ namespace gpgmm { class ThreadPool; - // An event that we can wait on, useful for joining worker threads. + /** \brief An event that we can wait on. + + Used for waiting for results or joining worker threads. + */ class Event : public NonCopyable { public: Event() = default; virtual ~Event() = default; - // Blocks calling thread indefinitely until |this| event is signaled. + /** \brief Wait for the event to complete. + + Wait blocks the calling thread indefinitely until the event gets signaled. + */ virtual void Wait() = 0; - // Checks if |this| event was signaled. + /** \brief Check if event was signaled. + + Event will be in signaled state once the event is completed. + */ virtual bool IsSignaled() = 0; - // Signals the event is ready. If ready, wait() will not block. + /** \brief Signals the event is ready. + + If ready, wait() will not block. + */ virtual void Signal() = 0; + /** \brief Associates a thread pool with this event. + + @param pool Shared pointer to the thread pool this event belongs with. + */ void SetThreadPool(std::shared_ptr pool); private: