From 3a93809df9ace02da20fa5f91e4c72fa3b3f8a82 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 8 Jul 2014 15:44:13 +0200 Subject: improvements to ShareableMutex - add some docs - remove unnecessary null checks - improve field name Change-Id: I8299ec0d56ee5d903f05f2790f97f90ca00663cb --- framework/inc/helper/shareablemutex.hxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'framework/inc') diff --git a/framework/inc/helper/shareablemutex.hxx b/framework/inc/helper/shareablemutex.hxx index 73c62ab11245..1a3b506906da 100644 --- a/framework/inc/helper/shareablemutex.hxx +++ b/framework/inc/helper/shareablemutex.hxx @@ -27,6 +27,9 @@ namespace framework { +/** + * This acts like a rtl::Reference + */ class FWI_DLLPUBLIC ShareableMutex { public: @@ -34,12 +37,15 @@ class FWI_DLLPUBLIC ShareableMutex ShareableMutex( const ShareableMutex& rShareableMutex ); const ShareableMutex& operator=( const ShareableMutex& rShareableMutex ); - ~ShareableMutex(); + ~ShareableMutex() { m_pMutexRef->release(); } + /** acquire the shared mutex */ void acquire(); + /** release the shared mutex */ void release(); private: + /* ShareableMutex::MutexRef will destroy itself when the last ShareableMutex pointing to it is destroyed */ struct MutexRef { MutexRef() : m_refCount(0) {} @@ -58,7 +64,7 @@ class FWI_DLLPUBLIC ShareableMutex osl::Mutex m_oslMutex; }; - MutexRef* pMutexRef; + MutexRef* m_pMutexRef; }; class ShareGuard -- cgit