Daniel Rall wrote:
> On Jul 25, 2007, at 12:26 PM, David Glasser wrote:
>> On 7/25/07, Daniel Rall <email@example.com> wrote:
>>> On Jul 25, 2007, at 9:53 AM, C. Michael Pilato wrote:
>>> > 3. don't rev svn_repos_history(), and use callback cancellation
>>> > exclusively to control continuation of the function.
>>> I like option #3, , along with an svn_cancel_func_t implementation
>>> which treats its baton as a limit and count parameter.
> Turns out Mike was really talking about having ANY callback be able to
> return an error code (a la SVN_ERR_CANCELLED) signifying that the
> callback should not be invoked again. Invokers of the callback would
> catch this error, clear it, and return SVN_NO_ERROR.
> David pointed out that while this works for most cases, that sometimes
> you want to invoke a cancellation callback more often than you would a
> function callback.
Right. Which is why I was *not* also advocating removing cancel_funcs from
functions that take them. I'm talking about supporting the likes of this:
/* Do something. */
/* If our baton is setup with a limit and we've reached
it, signal the callback driver to stop calling us. */
if (baton.limit && (++baton.count > baton.limit))
svn_error_t do_something(callback, baton, cancel_func, cancel_baton)
/* Do something that takes a while. See if user wants to cancel
/* Do something else that takes a while. See if user wants
to cancel afterwards. */
/* Call the main callback, which might tell us to stop
calling it. */
err = callback(baton)
if (err && err->apr_err == SVN_ERR_CANCELLED)
C. Michael Pilato <firstname.lastname@example.org>
CollabNet <> www.collab.net <> Distributed Development On Demand
Received on Thu Jul 26 04:40:17 2007