[Libreoffice-commits] core.git: include/osl

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 10 15:49:42 UTC 2019


 include/osl/mutex.hxx |   46 +++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 17 deletions(-)

New commits:
commit cf09ec89a45c4e3435db4ca18f531a2333cc49df
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Apr 9 16:56:21 2019 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Apr 10 17:49:18 2019 +0200

    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 at fbihome.de>

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.
         */


More information about the Libreoffice-commits mailing list