subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1618600 - in /subversion/trunk/subversion: include/svn_error_codes.h libsvn_subr/mutex.c
Date Mon, 18 Aug 2014 13:18:36 GMT
Author: stefan2
Date: Mon Aug 18 13:18:36 2014
New Revision: 1618600

URL: http://svn.apache.org/r1618600
Log:
While our public API does not prohibit nested locking attempts to the
same mutex (e.g. via svn_fs_freeze) and returns an error on them, our
code should always be able to ensure correct lock release.  Therefore,
double release etc. should be considered a malfunction rather than an
ordinary error.

* subversion/include/svn_error_codes.h
  (SVN_ERR_INVALID_UNLOCK): Unreleased and no longer used. Drop.
  (SVN_ERR_INVALID_INPUT): Renumber to use contiguous error codes.

* subversion/libsvn_subr/mutex.c
  (svn_mutex__unlock): Consider improper unlocking a malfunction.

Suggested by: ivan

Modified:
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/libsvn_subr/mutex.c

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=1618600&r1=1618599&r2=1618600&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Mon Aug 18 13:18:36 2014
@@ -1431,13 +1431,8 @@ SVN_ERROR_START
              "Recursive locks are not supported")
 
   /** @since New in 1.9. */
-  SVN_ERRDEF(SVN_ERR_INVALID_UNLOCK,
-             SVN_ERR_MISC_CATEGORY_START + 44,
-             "Tried to release a non-locked mutex")
-
-  /** @since New in 1.9. */
   SVN_ERRDEF(SVN_ERR_INVALID_INPUT,
-             SVN_ERR_MISC_CATEGORY_START + 45,
+             SVN_ERR_MISC_CATEGORY_START + 44,
              "Parser error: invalid input")
 
   /* command-line client errors */

Modified: subversion/trunk/subversion/libsvn_subr/mutex.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/mutex.c?rev=1618600&r1=1618599&r2=1618600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/mutex.c (original)
+++ subversion/trunk/subversion/libsvn_subr/mutex.c Mon Aug 18 13:18:36 2014
@@ -191,8 +191,7 @@ svn_mutex__unlock(svn_mutex__t *mutex,
                  thread ID.  Double check to be sure. */
               if (!apr_os_thread_equal((apr_os_thread_t)lock_owner,
                                        apr_os_thread_current()))
-                return svn_error_create(SVN_ERR_INVALID_UNLOCK, NULL, 
-                                  _("Tried to release a non-locked mutex"));
+                SVN_ERR_MALFUNCTION();
             }
 
           /* Now, set it to NULL. */
@@ -207,9 +206,9 @@ svn_mutex__unlock(svn_mutex__t *mutex,
       /* Update lock counter. */
       if (mutex->checked)
         {
+          /* Trying to release a non-locked mutex? */
           if (mutex->count <= 0)
-            return svn_error_create(SVN_ERR_INVALID_UNLOCK, NULL, 
-                                    _("Tried to release a non-locked mutex"));
+            SVN_ERR_MALFUNCTION();
 
           --mutex->count;
         }



Mime
View raw message