Skip to content
Prev 8859 / 12125 Next

[R-pkg-devel] Best current way to hook into the event loop?

Duncan,

I don't know if it is best, but you can have a look at "background"[1] which is I believe what "later" was inspired by. It is a very minimal example so should give you ideas on how to do that in your package - it runs the R code on the main thread so it should be as close to safe as one can get with asynchronous calls, just beware of reentrance. In your case I suspect that you may already have an X11 fd that you can use in the unix handler - not sure what signaling you need on Windows, though.

Cheers,
Simon

[1] - https://github.com/s-u/background