[R] Threads in R

Immanuel mane.desk at googlemail.com
Thu Aug 25 00:00:57 CEST 2011


Thanks again, you are perfectly right. I checked and saw I was indeed
polluting my machine with unclosed threads.

On 08/23/2011 01:34 AM, Peter Langfelder wrote:
> On Mon, Aug 22, 2011 at 3:12 PM, Immanuel <mane.desk at googlemail.com> wrote:
>> Hello,
>>
>> thanks for the input. Below is a small example, simpler then expected :)
>>  I'm just curious why I can't see any output from print(i).
>>
>> ----------------------
>> library(multicore)
>>
>> f_long <- function() {
>>    for (i in 1:100000000){ a=i}
>>        print(i)
>>    return("finished")
>> }
>>
>> p_long <- parallel(f_long() ,silent =FALSE    )
>> collect(p_long, wait=FALSE, 10)
>> # stops the execution since its not finished after 10sec
>> # on my machine anyway ;)
> I could be wrong on this, but according to the help file, collect(wait
> = FALSE) will not kill the child process, it will only collect
> whatever result the child process has sent until then using
> sendMaster(). I believe you have to kill() the child process to stop
> it completely.
>
> Peter
>



More information about the R-help mailing list