From 2aa7daab7037e9959863bd0ec13c3b4db3cfe35f Mon Sep 17 00:00:00 2001 From: fallenoak Date: Wed, 28 Dec 2022 15:54:37 -0600 Subject: [PATCH] feat(thread): add SCritSect destructor --- storm/thread/SCritSect.cpp | 10 ++++++++++ storm/thread/SCritSect.hpp | 1 + 2 files changed, 11 insertions(+) diff --git a/storm/thread/SCritSect.cpp b/storm/thread/SCritSect.cpp index 2dc6e9d..db05ca4 100644 --- a/storm/thread/SCritSect.cpp +++ b/storm/thread/SCritSect.cpp @@ -14,6 +14,16 @@ SCritSect::SCritSect() { #endif } +SCritSect::~SCritSect() { +#if defined(WHOA_SYSTEM_WIN) + DeleteCriticalSection(&this->m_opaqueData); +#endif + +#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX) + pthread_mutex_destroy(&this->m_mutex); +#endif +} + void SCritSect::Enter() { #if defined(WHOA_SYSTEM_WIN) EnterCriticalSection(&this->m_opaqueData); diff --git a/storm/thread/SCritSect.hpp b/storm/thread/SCritSect.hpp index 552a871..8ad6b38 100644 --- a/storm/thread/SCritSect.hpp +++ b/storm/thread/SCritSect.hpp @@ -22,6 +22,7 @@ class SCritSect { // Member functions SCritSect(); + ~SCritSect(); void Enter(void); void Leave(void); };