On May 21, 2014, at 1:47 PM, Jeroen Ooms <jeroen.o...@stat.ucla.edu> wrote:
> On Wed, May 21, 2014 at 10:17 AM, Josef Leydold <josef.leyd...@wu.ac.at> > wrote: > I ran into an issue with the parallel package in R-3.1.0. > > I have been experiencing a very similar issue within the RAppArmor package. > Here is a smaller example: > > library(parallel) > for (n in 1:5) { > p <- mcparallel(sqrt(n)) > #Sys.sleep(0.01) > res <- mccollect(p, wait=FALSE, timeout=1000) > mccollect(p) > if (is.null(res)) cat(n," NULL!\n") > } > > If we run this, mccollect returns a lot of NULL values. However, after > uncommenting the sys.sleep, the problem disappears. Seems like some sort of > race condition. > It's not a race condition - it behaves as expected - the mccollect with wait=FALSE will return NULL since there is no reason to expect the result to be available at that point. If you add the delay, then it's more likely that the result will be available by then. Cheers, Simon ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel