You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/11/25 22:07:38 UTC
svn commit: r1413420 - in /subversion/trunk/subversion:
include/private/svn_named_atomic.h libsvn_subr/named_atomic.c
Author: stefan2
Date: Sun Nov 25 21:07:38 2012
New Revision: 1413420
URL: http://svn.apache.org/viewvc?rev=1413420&view=rev
Log:
Extend the commentary on named atomic code and API. Also, fix an
error return not being passed up the caller chain.
* subversion/include/private/svn_named_atomic.h
(svn_atomic_namespace__cleanup): extend the notes in the docstring
* subversion/libsvn_subr/named_atomic.c
(delete_lock_file): return failures to close the file handle
(validate): expand docstring
(svn_atomic_namespace__create): expand commentary
Modified:
subversion/trunk/subversion/include/private/svn_named_atomic.h
subversion/trunk/subversion/libsvn_subr/named_atomic.c
Modified: subversion/trunk/subversion/include/private/svn_named_atomic.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_named_atomic.h?rev=1413420&r1=1413419&r2=1413420&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_named_atomic.h (original)
+++ subversion/trunk/subversion/include/private/svn_named_atomic.h Sun Nov 25 21:07:38 2012
@@ -104,8 +104,10 @@ svn_atomic_namespace__cleanup(const char
* characters and an error will be returned if the specified name is longer
* than supported.
*
- * @note The lifetime of the atomic is bound to the lifetime
+ * @note The lifetime of the atomic object is bound to the lifetime
* of the @a ns object, i.e. the pool the latter was created in.
+ * The data in the namespace persists as long as at least one process
+ * holds an #svn_atomic_namespace__t object corresponding to it.
*/
svn_error_t *
svn_named_atomic__get(svn_named_atomic__t **atomic,
Modified: subversion/trunk/subversion/libsvn_subr/named_atomic.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/named_atomic.c?rev=1413420&r1=1413419&r2=1413420&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/named_atomic.c (original)
+++ subversion/trunk/subversion/libsvn_subr/named_atomic.c Sun Nov 25 21:07:38 2012
@@ -308,7 +308,7 @@ delete_lock_file(void *arg)
const char *lock_name = NULL;
/* locks have already been cleaned up. Simply close the file */
- apr_file_close(mutex->lock_file);
+ apr_status_t status = apr_file_close(mutex->lock_file);
/* Remove the file from disk. This will fail if there ares still other
* users of this lock file, i.e. namespace. */
@@ -316,10 +316,12 @@ delete_lock_file(void *arg)
if (lock_name)
apr_file_remove(lock_name, mutex->pool);
- return 0;
+ return status;
}
-/* Validate the ATOMIC parameter, i.e it's address.
+/* Validate the ATOMIC parameter, i.e it's address. Correct code will
+ * never need this but if someone should accidentally to use a NULL or
+ * incomplete structure, let's catch that here instead of segfaulting.
*/
static svn_error_t *
validate(svn_named_atomic__t *atomic)
@@ -416,7 +418,9 @@ svn_atomic_namespace__create(svn_atomic_
APR_OS_DEFAULT,
result_pool));
- /* Make sure the last user of our lock file will actually remove it
+ /* Make sure the last user of our lock file will actually remove it.
+ * Please note that only the last file handle begin closed will actually
+ * remove the underlying file (see docstring for apr_file_remove).
*/
apr_pool_cleanup_register(result_pool, &new_ns->mutex,
delete_lock_file,