Re: [Rd] checking user interrupts in C(++) code

2010-09-29 Thread Karl Forner
Hi, Thanks for your reply, There are several ways in which you can make your code respond to interrupts properly - which one is suitable depends on your application. Probably the most commonly used for interfacing foreign objects is to create an external pointer with a finalizer - that makes

Re: [Rd] checking user interrupts in C(++) code

2010-09-29 Thread Gábor Csárdi
Karl, I think you right, if you are not controlling all memory allocation, then you cannot do anything. In the igraph package, I keep a stack that contains all allocated objects, and also their destructor. In case of an error, or an interrupt, I go over the stack and call all destructors. (I use

Re: [Rd] checking user interrupts in C(++) code

2010-09-29 Thread Berwin A Turlach
G'day Simon, since Karl brought up this topic, I thought I might use it to seek clarification for something that bothered me for some time. On Tue, 28 Sep 2010 14:55:34 -0400 Simon Urbanek simon.urba...@r-project.org wrote: There are several ways in which you can make your code respond to

Re: [Rd] checking user interrupts in C(++) code

2010-09-29 Thread Simon Urbanek
On Sep 29, 2010, at 11:34 AM, Berwin A Turlach wrote: G'day Simon, since Karl brought up this topic, I thought I might use it to seek clarification for something that bothered me for some time. On Tue, 28 Sep 2010 14:55:34 -0400 Simon Urbanek simon.urba...@r-project.org wrote: There

Re: [Rd] checking user interrupts in C(++) code

2010-09-29 Thread Simon Urbanek
On Sep 29, 2010, at 4:31 AM, Karl Forner wrote: Hi, Thanks for your reply, There are several ways in which you can make your code respond to interrupts properly - which one is suitable depends on your application. Probably the most commonly used for interfacing foreign objects is to

[Rd] checking user interrupts in C(++) code

2010-09-28 Thread Karl Forner
Hello, My problem is that I have an extension in C++ that can be quite time-consuming. I'd like to make it interruptible. The problem is that if I use the recommended R_CheckUserInterrupt() method I have no possibility to cleanup (e.g. free the memory). I've seen an old thread about this, but I

Re: [Rd] checking user interrupts in C(++) code

2010-09-28 Thread Simon Urbanek
Karl, On Sep 28, 2010, at 12:52 PM, Karl Forner wrote: My problem is that I have an extension in C++ that can be quite time-consuming. I'd like to make it interruptible. The problem is that if I use the recommended R_CheckUserInterrupt() method I have no possibility to cleanup (e.g. free