If you are using an external pointer you can register a finalizer that
does the cleanup at gc time in case of an abnormal exit. Otherwise
you should for now be able to use R_ToplevelExec tigether with
R_CheckUserInterrupt as I suggested previously.
Best,
luke
On Wed, 21 May 2008, Kjell Konis
I would actually prefer a mechanism that simply returns a flag
indicating that an interrupt has been requested. Then I would be able
to clean up and return on my own - no longjmp required. Also, it would
be useful if there was a function similar to R_ProcessEvents that only
dealt with
On May 20, 2008, at 10:58 AM, Kjell Konis wrote:
I would actually prefer a mechanism that simply returns a flag
indicating that an interrupt has been requested. Then I would be
able to clean up and return on my own - no longjmp required. Also,
it would be useful if there was a function
The problem is that my package uses an external pointer to keep track
of a structure created by the lp_solve library. If I use
R_CheckUserInterrupt in the lp_solve abort function it leaves the
structure in a messed-up state after an interrupt occurs. I am not
even able to free the memory
On Fri, 16 May 2008, Kjell Konis wrote:
You mean something like this (I return 1 instead of calling onintr())? Will
HAVE_AQUA and Win32 be appropriately defined when building my package (I
can't see how to check with R CMD config)?
HAVE_AQUA is in Rconfig.h, and WIN32 (not Win32) is defined
I'm not sure you can make this work as some of the things needed
either are or should be private to the core implementation and not
available to package code. In any case I would not recommend this
approach for two reasons. First, details of what happens in interrupt
checking are subject to
How is R_interrupts_pending going to be set?
It is set in the interrupt handler for SIGINT, but that is not the only
way to indicate an interrupt, and it is not necessarily available to users
of GUIs and embedded R.
Without servicing the GUIs all interaction will be dead, including sending