[Rd] Background R session on Unix and SIGINT
Simon Urbanek
@|mon@urb@nek @end|ng |rom R-project@org
Tue Apr 30 22:13:43 CEST 2019
Interrupts are not synchronous in R - the signal only flags the request for interruption. Nothing actually happens until R_CheckUserInterrupt() is called at an interruptible point. In you case your code is apparently not calling R_CheckUserInterrupt() until later as a side-effect of the next evaluation.
Cheers,
Simon
> On Apr 30, 2019, at 3:44 PM, Gábor Csárdi <csardi.gabor using gmail.com> wrote:
>
> Hi All,
>
> I realize that this is not a really nice reprex, but anyone has an
> idea why a background R session would "remember" an interrupt (SIGINT)
> on Unix?
>
> rs <- callr::r_session$new()
> rs$interrupt() # just sends a SIGINT
> #> [1] TRUE
>
> rs$run(function() 1+1)
> #> Error: interrupt
>
> rs$run(function() 1+1)
> #> [1] 2
>
> It seems that the main loop somehow stores the SIGINT it receives
> while it is waiting on stdin, and then it triggers it when some input
> comes in.... Maybe. Just speculating....
>
> Thanks,
> Gabor
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list