◐ Shell
clean mode source ↗

add isForkedChild() for tbb fork-safety checks by kevinushey · Pull Request #244 · RcppCore/RcppParallel

@kevinushey

closes #243.

tbb does not support being used after fork(). downstream packages can't
reliably detect this themselves because rcppparallel — and therefore tbb —
may have been loaded into the parent long before the downstream package
gets a chance to record a baseline pid.

capture getpid() in R_init_RcppParallel and expose RcppParallel::isForkedChild()
(c++) plus isForkedChild() (r) so callers can fall back to a serial path
when running inside a fork()'d child (e.g. under parallel::mclapply).
windows is a no-op (always false) since it has no fork().