From e8d00f07257b928e85c89236f5d78810bb5df583 Mon Sep 17 00:00:00 2001 From: Emiel Por Date: Wed, 6 Nov 2024 12:11:00 -0800 Subject: [PATCH] Add friend classes and fix class name typos. --- catkit_core/SynchronizationConditionVariable.h | 1 + catkit_core/SynchronizationSemaphore.cpp | 4 ++-- catkit_core/SynchronizationSemaphore.h | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/catkit_core/SynchronizationConditionVariable.h b/catkit_core/SynchronizationConditionVariable.h index f2cabf90..2027215c 100644 --- a/catkit_core/SynchronizationConditionVariable.h +++ b/catkit_core/SynchronizationConditionVariable.h @@ -16,6 +16,7 @@ struct SharedStateConditionVariable class SynchronizationConditionVariable : public SynchronizationBase { friend SynchronizationBase; + public: void Wait(long timeout_in_ms, std::function condition, void (*error_check)()); void Signal(); diff --git a/catkit_core/SynchronizationSemaphore.cpp b/catkit_core/SynchronizationSemaphore.cpp index 63a986ff..b381011f 100644 --- a/catkit_core/SynchronizationSemaphore.cpp +++ b/catkit_core/SynchronizationSemaphore.cpp @@ -71,7 +71,7 @@ void SynchronizationSemaphore::CreateImpl(const std::string &id, SharedState *sh if (m_Semaphore == NULL) throw std::runtime_error("Something went wrong while creating semaphore."); - shared_data->m_NumReadersWaiting = 0; + shared_state->m_NumReadersWaiting = 0; } void SynchronizationSemaphore::OpenImpl(const std::string &id, SharedState *shared_state) @@ -82,7 +82,7 @@ void SynchronizationSemaphore::OpenImpl(const std::string &id, SharedState *shar throw std::runtime_error("Something went wrong while opening semaphore."); } -void SynchronizationSempahore::CloseImpl() +void SynchronizationSemaphore::CloseImpl() { CloseHandle(m_Semaphore); } diff --git a/catkit_core/SynchronizationSemaphore.h b/catkit_core/SynchronizationSemaphore.h index 778007ba..46cd2f92 100644 --- a/catkit_core/SynchronizationSemaphore.h +++ b/catkit_core/SynchronizationSemaphore.h @@ -19,16 +19,16 @@ struct SharedStateSemaphore class SynchronizationSemaphore : public SynchronizationBase { + friend SynchronizationBase; + public: void Wait(long timeout_in_ms, std::function condition, void (*error_check)()); void Signal(); - void Lock(); - void Unlock(); - protected: void CreateImpl(const std::string &id, SharedState *shared_state); void OpenImpl(const std::string &id, SharedState *shared_state); + void CloseImpl(); HANDLE m_Semaphore; };