This is the mail archive of the
mailing list for the Guile project.
Re: How to make user-defined functions abortable
MD> Lars Arvestad <email@example.com> 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.
MD> It is not a good idea to be a long time inside
MD> SCM_DEFER_INTS/SCM_ALLOW_INTS, and I don't think it is necessary.
MD> Why do you need this protection?
Don't want to leak memory.
MD> If the reason for the protection is that you don't want to leak
MD> allocated memory, I suggest that you put up an error handler using
MD> scm_internal_catch which frees resources.
I'll look into scm_internal_catch then!
Lars Arvestad Dept. of Numerical Analysis and Computing Science
Royal Institute of Technology (KTH), Stockholm, Sweden