Re: [Rd] Interrupting C++ code execution

2011-04-26 Thread schattenpflanze
I have tested the solutions suggested by Simon and Thomas on a Linux machine. These are my findings: On Windows you can look at the variable "UserBreak", available from Rembedded.h. Outside of Windows, you can look at R_interrupts_pending, available from R_ext/GraphicsDevice.h. R_ext/GraphicsDe

Re: [Rd] Interrupting C++ code execution

2011-04-25 Thread schattenpflanze
Dear Simon, thanks again for your explanations. Your previous e-mail clarified several points for me. Actually, it just came to me that there is a hack you could use. [...] That actually looks quite nice. At least when compared to my currently only alternative of not interrupting at all. I w

Re: [Rd] Interrupting C++ code execution

2011-04-25 Thread schattenpflanze
Thank you for your response, Simon. 1. Calling R_CheckUserInterrupt() interrupts immediately, so I have no possibility to exit my code gracefully. In particular, I suppose that objects created on the heap (e.g., STL containers) are not destructed properly. In general, you're responsible for the

[Rd] Interrupting C++ code execution

2011-04-25 Thread schattenpflanze
Hello, I am writing an R interface for one of my C++ programs. The computations in C++ are very time consuming (several hours), so the user needs to be able to interrupt them. Currently, the only way I found to do so is calling R_CheckUserInterrupt() frequently. Unfortunately, there are sever