I am trying to write a background task that will run an R callback function whenever it completes. I believe I have followed the instructions in the vignette titled Using later from C++. In particular, I read that the execute method of my later::BackgroundTask must not call any R code, but that I can call R code from complete. However, when I call my R callback function from the complete I get a segfault. I would like to understand why this approach does not seem to work.
I have created the github repository latercallback with a simplified demo of my approach. My later::BackgroundTask subclass is contained in the file latercallback.cpp.
While experimenting with this, I also discovered that I can make the callback mechanism work by removing the comment on line 11, but I don't know why.
I am trying to write a background task that will run an R callback function whenever it completes. I believe I have followed the instructions in the vignette titled Using later from C++. In particular, I read that the
execute
method of mylater::BackgroundTask
must not call any R code, but that I can call R code fromcomplete
. However, when I call my R callback function from thecomplete
I get a segfault. I would like to understand why this approach does not seem to work.I have created the github repository latercallback with a simplified demo of my approach. My
later::BackgroundTask
subclass is contained in the file latercallback.cpp.While experimenting with this, I also discovered that I can make the callback mechanism work by removing the comment on line 11, but I don't know why.
Any insight would be appreciated!