summaryrefslogtreecommitdiff
path: root/framework/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-07-08 15:44:13 +0200
committerNoel Grandin <noel@peralex.com>2014-07-10 11:04:10 +0200
commit3a93809df9ace02da20fa5f91e4c72fa3b3f8a82 (patch)
tree70e7e66a31cc6c93782c1fadc770579b14723ae2 /framework/inc
parent0a90643947e3767fd5d76784df54d7ee25e6793d (diff)
improvements to ShareableMutex
- add some docs - remove unnecessary null checks - improve field name Change-Id: I8299ec0d56ee5d903f05f2790f97f90ca00663cb
Diffstat (limited to 'framework/inc')
-rw-r--r--framework/inc/helper/shareablemutex.hxx10
1 files changed, 8 insertions, 2 deletions
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<osl::Mutex>
+ */
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