summaryrefslogtreecommitdiffstats
path: root/include/osl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-04-09 16:56:21 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2019-04-10 17:49:18 +0200
commitcf09ec89a45c4e3435db4ca18f531a2333cc49df (patch)
treeea6f523893931a41f75f2b53e9434bfae826c0ef /include/osl
parenttdf#124646 Don't paste hidden rows of Calc sheets into Writer tables (diff)
downloadcore-cf09ec89a45c4e3435db4ca18f531a2333cc49df.tar.gz
core-cf09ec89a45c4e3435db4ca18f531a2333cc49df.zip
Unify deleted function templates and improve docs
... and doesn't change any code or API. Change-Id: Ic769831130bb78b8192ffd33375760bef9b76911 Reviewed-on: https://gerrit.libreoffice.org/70466 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'include/osl')
-rw-r--r--include/osl/mutex.hxx46
1 files changed, 29 insertions, 17 deletions
diff --git a/include/osl/mutex.hxx b/include/osl/mutex.hxx
index ea7cdf50d19e..0297232065b0 100644
--- a/include/osl/mutex.hxx
+++ b/include/osl/mutex.hxx
@@ -103,19 +103,23 @@ namespace osl
Mutex& operator= (const Mutex&) SAL_DELETED_FUNCTION;
};
- /** A helper class for mutex objects and interfaces.
- */
+ /** Object lifetime scoped mutex object or interface lock.
+ *
+ * Aquires the template object on construction and releases it on
+ * destruction.
+ *
+ * @see MutexGuard
+ */
template<class T>
class Guard
{
- private:
- Guard( const Guard& ) SAL_DELETED_FUNCTION;
- const Guard& operator = ( const Guard& ) SAL_DELETED_FUNCTION;
+ Guard(const Guard&) SAL_DELETED_FUNCTION;
+ Guard& operator=(const Guard&) SAL_DELETED_FUNCTION;
protected:
T * pT;
- public:
+ public:
/** Acquires the object specified as parameter.
*/
Guard(T * pT_) : pT(pT_)
@@ -138,19 +142,22 @@ namespace osl
}
};
- /** A helper class for mutex objects and interfaces.
- */
+ /** Object lifetime scoped mutex object or interface lock with unlock.
+ *
+ * Use this if you can't use scoped code blocks and Guard.
+ *
+ * @see ClearableMutexGuard, Guard
+ */
template<class T>
class ClearableGuard
{
- private:
ClearableGuard( const ClearableGuard& ) SAL_DELETED_FUNCTION;
- const ClearableGuard& operator = ( const ClearableGuard& )
- SAL_DELETED_FUNCTION;
+ ClearableGuard& operator=(const ClearableGuard&) SAL_DELETED_FUNCTION;
+
protected:
T * pT;
- public:
+ public:
/** Acquires the object specified as parameter.
*/
ClearableGuard(T * pT_) : pT(pT_)
@@ -184,17 +191,22 @@ namespace osl
}
};
- /** A helper class for mutex objects and interfaces.
- */
+ /** Template for temporary releasable mutex objects and interfaces locks.
+ *
+ * Use this if you want to acquire a lock but need to temporary release
+ * it and can't use multiple scoped Guard objects.
+ *
+ * @see ResettableMutexGuard
+ */
template< class T >
class ResettableGuard : public ClearableGuard< T >
{
- private:
- ResettableGuard(ResettableGuard &) SAL_DELETED_FUNCTION;
- void operator =(ResettableGuard &) SAL_DELETED_FUNCTION;
+ ResettableGuard(const ResettableGuard&) SAL_DELETED_FUNCTION;
+ ResettableGuard& operator=(const ResettableGuard&) SAL_DELETED_FUNCTION;
protected:
T* pResetT;
+
public:
/** Acquires the object specified as parameter.
*/