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

Re: abort() calls

From: Jonathan Gilbert <o2w9gs702_at_sneakemail.com>
Date: 2007-04-29 05:55:34 CEST

At 10:13 PM 4/28/2007 +0200, Brane wrote:
>Stefan Küng wrote:
>> Hi,
>> In the Subversion code, there are a lot of calls to the abort()
>> function. I think those should be removed and replaced with something
>> else.
>Oh wow, you've gone and opened a can of worms that we've had trouble
>closing in the past.
>I'm willing to consider using something else instead of abort(). But
>someone will have to come up with a proposal that works everywhere, not
>just in Windows GUI with just-in-time debugging.

What about -- on platforms that support it -- allowing the project calling
into the library to provide a jmp_buf to be longjmp()ed to instead of
abort()ing, and replacing the abort() calls with calls to a wrapper
function to pick between that and abort() if the user hasn't provided a
jmp_buf (or the platform doesn't support it)?

I don't know what Subversion's policy is on threading, but of course if
multiple threads were to be involved, each thread would need its own
jmp_buf, and either way, they would probably be best arranged in a stack,
so that a routine could do this and not interfere with the caller's policy:

  if (setjmp(my_jmp_buf))
      return; /* or abort(); or whatnot */


  ... /* (calls to Subversion API here) */


I suppose also the stack could be offloaded to the caller so that the
execution stack could be used for the purpose, as in:

  if (setjmp(my_jmp_buf))

  callers_jmp_buf = svn_set_emergency_exit_handler(my_jmp_buf);

  ... /* (calls to Subversion API here) */


Most code would not need to use the feature, but anything integrating into
a persistent user interface (like TortoiseSVN) would find it very useful.

Just an idea.. :-)

Jonathan Gilbert

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Apr 29 05:56:34 2007

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.