diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-04-09 16:56:21 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-04-10 17:49:18 +0200 |
commit | cf09ec89a45c4e3435db4ca18f531a2333cc49df (patch) | |
tree | ea6f523893931a41f75f2b53e9434bfae826c0ef /include/osl | |
parent | 0c3ac02d8a3c7ea50ae262daf134c28df5c8b343 (diff) |
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.hxx | 46 |
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. */ |