[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: permissions (and other) problems

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-09-13 15:48:03 CEST

Garrett Rooney <rooneg@electricjellyfish.net> writes:

> Index: subversion/include/svn_error.h
> ===================================================================
> --- subversion/include/svn_error.h
> +++ subversion/include/svn_error.h Thu Sep 12 22:49:39 2002
[snip]
> @@ -151,6 +175,8 @@
> svn_error_t *svn_err__temp = (expr); \
> if (svn_err__temp) \
> return svn_err__temp; \
> + else if (svn__async_canceled ()) \
> + return svn__async_cancelation_error (); \

Generating the error by calling a function will mean that the
debugging line number associated with the error will refer to that
function. If you called svn_error_create directly would mean that the
line number would refer to the SVN_ERR macro, which is much more
interesting, although it may increase the code size.

> } while (0)
>
>
> Index: subversion/libsvn_subr/cancel.c
> ===================================================================
> --- subversion/libsvn_subr/cancel.c
> +++ subversion/libsvn_subr/cancel.c Thu Sep 12 22:36:31 2002
> @@ -0,0 +1,80 @@
> +/*
> + * cancel.c: support for asyncronous cancelation of subversion functions
> + *
> + * ====================================================================
> + * Copyright (c) 2000-2002 CollabNet. All rights reserved.
> + *
> + * This software is licensed as described in the file COPYING, which
> + * you should have received as part of this distribution. The terms
> + * are also available at http://subversion.tigris.org/license-1.html.
> + * If newer versions of this license are posted there, you may use a
> + * newer version instead, at your option.
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals. For exact contribution history, see the revision
> + * history and logs, available at http://subversion.tigris.org/.
> + * ====================================================================
> + */
> +
> +
> +
> +#include "svn_error.h"
> +#include "svn_pools.h"
> +
> +
> +/*** Code. ***/
> +
> +static volatile sig_atomic_t canceled = FALSE;

Is canceled an Americanism? I'd have spelt it cancelled.

> +
> +static svn_boolean_t cancelation_in_progress = FALSE;

Why the second flag?

> +
> +static apr_pool_t *cancelation_pool;
> +
> +svn_boolean_t
> +svn__async_canceled(void)
> +{
> + return canceled;
> +}
> +
> +svn_error_t *
> +svn__async_cancelation_error(void)
> +{
> + canceled = FALSE;
> +
> + cancelation_in_progress = TRUE;
> +
> + return svn_error_create (SVN_ERR_CANCELED, 0, NULL,
> cancelation_pool, NULL);
>
> +}
> +
> +svn_boolean_t
> +svn__async_cancelation_in_progress (void)
> +{
> + return cancelation_in_progress;
> +}
> +
> +void
> +svn_async_register_cancelation_pool (apr_pool_t *pool)
> +{
> + cancelation_pool = pool;
> +}
> +
> +void
> +svn_async_cancel(void)
> +{
> + if (! cancelation_in_progress)

Given that this is a signal handler, the above test looks a little
suspicious. Is it necessary? Can't you just set cancelled
unconditionally? I'm not sure why you need two flags anyway, doesn't
cancelled provide enough state?

> + canceled = TRUE;
> +}

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 13 18:09:16 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.