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

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu Feb 2 22:53:34 CET 2023


I'm updating low level stuff in the rgl package.  I'm exploring using 
the GLFW library to handle low level stuff instead of trying to do that 
myself.

Currently rgl has fairly ugly code to link into the R event loop.  (It 
needs to do this so that it hears about mouse movement, etc.)  I'm 
hoping that someone else has written better code than I could to do 
this.  Is there a currently recommended way to hook into the loop?

The kinds of things I need are getting events fairly frequently (e.g. 
0.03 second delay if things aren't too busy) for code that doesn't 
involve R at all.

I will also occasionally want to call back into R; I don't really mind 
if there's a bigger delay to wait for that to be safe.

I've seen the "later" package:  it looks as though it might do what I 
need, but the protection for R code seems to be all or nothing, i.e. if 
I want to evaluate an R expression nothing else can be running, or if I 
want action while R code is running, I can't involve R at all.

Duncan Murdoch



More information about the R-package-devel mailing list