[Rd] interrupting native code
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu May 15 16:41:48 CEST 2008
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
an interrrupt from menus/buttons/keyboard. See the comment in the code
for R_CheckUserInterrupt.
On Thu, 15 May 2008, Kjell Konis wrote:
> Hello,
>
> I have some native code that I would like to allow users to interrupt.
> However, I would like to do it more gracefully than with
> R_CheckUserInterrupt(). The solution I came up with is to call the following
> abort function periodically - if it returns 1 then I clean up and return.
>
> int __WINAPI RlpSolveAbortFunction(lprec *lp, void *userhandle)
> {
> if(R_interrupts_pending)
> return(1);
>
> return(0);
> }
>
> This seems to work fine on Mac (sans Aqua) and Linux. Is this going to be
> portable? Also, is there anything else I need to do? For instance set
> R_interrupts_pending to 0 after I respond to it?
>
> Thanks.
> Kjell
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list