Re: [Rd] Interrupting C++ code execution

From: Thomas Friedrichsmeier <thomas.friedrichsmeier_at_ruhr-uni-bochum.de>
Date: Mon, 25 Apr 2011 20:17:57 +0200

On Monday 25 April 2011, Simon Urbanek wrote:
> Actually, it just came to me that there is a hack you could use. The
> problem with it is that it will eat all errors, even if they were not
> yours (e.g. those resulting from events triggered the event loop), so I
> would not recommend it for general use.

Here's another option which is probably not recommendable for general use, since it is not part of the documented API:

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/GraphicsDevice.h also has R_interrupts_suspended, which you may or may not want to take into account, depending on your use-case.

BTW, being able to check for a pending interrupt or to schedule an interrupt from a separate thread is something that can come in handy in GUI development as well, and personally, I would appreciate, if there was some slightly more official support for this.

Regards
Thomas



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 25 Apr 2011 - 18:21:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 13:30:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive