[Rd] [External] Re: Background R session on Unix and SIGINT

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Wed May 1 17:25:48 CEST 2019

On Wed, May 1, 2019 at 4:20 PM Simon Urbanek
<simon.urbanek using r-project.org> wrote:
> I think you're talking about two independent things. You can interrupt the computation, no question about that. It's just that if you send an interrupt while you're *not* doing any computations, it will be signaled but not raised until the interrupts are checked since there is no one to check it.

Right. That's what I suspected originally, so thank you both for
confirming it. The difficulty is, when I interrupt the computation
that's a race condition, because in the master process I have no idea
knowing whether the computation will be finished just before the
SIGINT arrives.

> This goes back to my original response - the interactive REPL calls R_CheckUserInterrupt(), but the straight stdin-prcessing doesn't (since it's expected to be a script, not interactive prompt). If you just want to clear interrupts before next processing you can either just run R_CheckUserInterrupt() explicitly, or on R side do anything that does that, e.g. to take your example "tryCatch(Sys.sleep(0), interrupt = function(e) e)" will clear it.

Yes, that's exactly what I am doing. Thanks again!



More information about the R-devel mailing list