Re: [Rd] parallel::mc*: Is it possible for a child process to know it is a fork?

2017-01-25 Thread Henrik Bengtsson
On Tue, Jan 24, 2017 at 8:10 PM, Jeroen Ooms wrote: > On Tue, Jan 24, 2017 at 7:06 PM, Henrik Bengtsson > wrote: >> When using multicore-forking of the parallel package, is it possible >> for a child process to know that it is a fork? > > R

Re: [Rd] parallel::mc*: Is it possible for a child process to know it is a fork?

2017-01-24 Thread Jeroen Ooms
On Tue, Jan 24, 2017 at 7:06 PM, Henrik Bengtsson wrote: > When using multicore-forking of the parallel package, is it possible > for a child process to know that it is a fork? R internally uses R_isForkedChild to prevent certain operations within the fork. However I

[Rd] parallel::mc*: Is it possible for a child process to know it is a fork?

2017-01-24 Thread Henrik Bengtsson
When using multicore-forking of the parallel package, is it possible for a child process to know that it is a fork? Something like: parallel::mclapply(1:10, FUN = function(i) { test_if_running_in_a_fork() }) I'm looking into ways to protect against further parallel processes (including