From A.R.Runnalls at kent.ac.uk  Thu Apr 28 14:55:44 2011
From: A.R.Runnalls at kent.ac.uk (Andrew Runnalls)
Date: Thu, 28 Apr 2011 13:55:44 +0100
Subject: [Rd] Interrupting C++ code execution
In-Reply-To: <4DB53D47.7060903@arcor.de>
References: <4DB53D47.7060903@arcor.de>
Message-ID: <4DB963D0.9020701@kent.ac.uk>

Peter,

On 25/04/11 10:22, schattenpflanze at arcor.de wrote:
> 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.

Sorry not to have seen this thread sooner.

You may like to give CXXR a try 
(http://www.cs.kent.ac.uk/projects/cxxr/).  In CXXR the R interpreter is 
written in C++, and a user interrupt is handled by throwing a C++ 
exception, so the stack is unwound in an orderly fashion, destructors 
are invoked, etc.

However, it's fair to say that in using CXXR with a multi-threaded 
program you'll be on the bleeding edge...

Andrew



[Rd] Interrupting C++ code execution
Andrew Runnalls