Closed nx10 closed 2 years ago
I ran the sample code in #83 on the Docker image r-base
(Debian-based/amd64 platform), and it worked well.
Tried this PR and it works quite nicely!
I also tried it with r-base
on arm64 (Raspberry Pi 4), and it seems to work just as well.
Thank you both for testing!
This PR is a rewrite of the IPC and execution layer used to communicate with R from off the main thread.
The excellent
later
package was used previously but it has some constraints (due to different use cases) that are not appropriate for httpgd.This PR is a complete replacement with less overhead and modern C++ features and lets us call into R even when the R session is not idle. It basically treats the session as the only worker of a thread pool and allows to individually await execution of C++ futures that run on the main thread.
Fixes: https://github.com/nx10/httpgd/issues/83 Will enable: https://github.com/nx10/httpgd/issues/94 This also will make writing and debugging async communication code for httpgd a lot easier.
I tested this on Windows 10 and a fedora VM, but it would be great if it was tested in more environments before I merge.