This is the mail archive of the
mailing list for the Guile project.
Re: How to make user-defined functions abortable
- To: Lars Arvestad <email@example.com>
- Subject: Re: How to make user-defined functions abortable
- From: Mikael Djurfeldt <firstname.lastname@example.org>
- Date: 19 Aug 1999 18:38:14 +0200
- Cc: email@example.com
- Cc: firstname.lastname@example.org
- References: <email@example.com>
Lars Arvestad <firstname.lastname@example.org> writes:
> I have a small set of C functions that I have hooked into
> Guile. Unfortunately, they allocate lots of memory and take a long
> time to execute, and there are times when it would be nice to do C-c
> and abort the execution. Due to the allocated memory, I need to
> protect the functions in SCM_DEFER_INTS/SCM_ALLOW_INTS which blocks
> the possibility of using C-c.
It is not a good idea to be a long time inside
SCM_DEFER_INTS/SCM_ALLOW_INTS, and I don't think it is necessary.
Why do you need this protection?
It should be possible to protect just certain critical operations.
(Also, it might be a good idea to do SCM_TICK once in a while so that
threading will continue to behave well.)
If the reason for the protection is that you don't want to leak
allocated memory, I suggest that you put up an error handler using
scm_internal_catch which frees resources.