Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isFork() #18

Closed
HenrikBengtsson opened this issue Oct 20, 2020 · 0 comments
Closed

Add isFork() #18

HenrikBengtsson opened this issue Oct 20, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@HenrikBengtsson
Copy link
Collaborator

HenrikBengtsson commented Oct 20, 2020

From futureverse/future#224 (comment), in a question on how to detect whether or not R runs in a forked process:

> parallel:::isChild()
[1] FALSE

> f <- parallel::mcparallel(parallel:::isChild())
> parallel::mccollect(f)
[[1]]
[1] TRUE

> cl <- parallel::makeForkCluster(1L)
> parallel::clusterEvalQ(cl, { parallel:::isChild() })
[[1]]
[1] TRUE

> cl <- parallel::makePSOCKcluster(1L)
> parallel::clusterEvalQ(cl, { parallel:::isChild() })
[[1]]
[1] FALSE
@HenrikBengtsson HenrikBengtsson added the enhancement New feature or request label Oct 20, 2020
@HenrikBengtsson HenrikBengtsson changed the title Export parallel:::isChild() Add isForked() Oct 21, 2020
@HenrikBengtsson HenrikBengtsson changed the title Add isForked() Add isFork() Oct 21, 2020
@HenrikBengtsson HenrikBengtsson added this to the Next release milestone Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant