[Rcpp-devel] Thread handling

Sean Robert McGuffee sean.mcguffee at gmail.com
Tue Apr 26 20:46:08 CEST 2011


Hi, 
I¹ve finally got a working start to using Rcpp to interface with some of my
c++ code, and now I have a practical question about the interface. My first
task was simply to launch algorithms from R, and thanks to a lot of help
from this community, I finally got that task solved. Now, however, I lose
all response from R as soon as I launch many long and intensive algorithms.
That isn¹t to say it isn¹t working, and the responsiveness comes back after
the jobs eventually finish. Ideally, I would like to let my users continue
to use R while their jobs run, and I can handle that in c++ with threads.
However, I also want to let my users know when their jobs finish. Ordinarily
I would register some sort of callback function in one of my own programs to
alert a user when a threaded task finishes. However, I don¹t know enough
about R to know how to send a message to a user, especially from external
code that has been called. As is, I¹m able to return an argument such as a
SEXP value from my function, and I can have it give feedback. However, if I
do that before the thread finishes, I don¹t know if there is a way to access
it any more after the thread finishes. Likewise, if I were to wait until the
thread finishes, then I might as well not call a thread. So what would be
recommended as an Rcpp suggested mechanism for alerting users in R as to
when threaded jobs finish?
Thanks,
Sean  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110426/812bf806/attachment-0001.htm>


More information about the Rcpp-devel mailing list