[Rd] interrupting native code

Kjell Konis kjell.konis at epfl.ch
Thu May 15 15:35:53 CEST 2008


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



More information about the R-devel mailing list