This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: How to make user-defined functions abortable
- To: Lars Arvestad <arve@nada.kth.se>
- Subject: Re: How to make user-defined functions abortable
- From: Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se>
- Date: 19 Aug 1999 18:38:14 +0200
- Cc: guile@sourceware.cygnus.com
- Cc: djurfeldt@nada.kth.se
- References: <yuer9l0qc6w.fsf@turing.nada.kth.se>
Lars Arvestad <arve@nada.kth.se> 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.