-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathisForkedChild.Rd
More file actions
32 lines (30 loc) · 956 Bytes
/
isForkedChild.Rd
File metadata and controls
32 lines (30 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fork.R
\name{isForkedChild}
\alias{isForkedChild}
\title{Is the Current Process a Forked Child?}
\usage{
isForkedChild()
}
\value{
A length-one logical.
}
\description{
Returns \code{TRUE} if the current process is a \code{fork()} of the process in which
RcppParallel was originally loaded.
}
\details{
Intel TBB — the parallel backend used by \code{parallelFor()} and
\code{parallelReduce()} — does not support being used in a child process after
\code{fork()}. Packages that may be invoked from within \code{parallel::mclapply()}
or similar fork-based parallelism should call \code{isForkedChild()} and fall
back to a serial code path when it returns \code{TRUE}.
On Windows, which has no \code{fork()}, this always returns \code{FALSE}.
}
\examples{
\dontrun{
library(RcppParallel)
isForkedChild()
parallel::mclapply(1:2, function(i) RcppParallel::isForkedChild())
}
}