From ea937365b4ae445beeaa4584c96a4b9e85f66f75 Mon Sep 17 00:00:00 2001 From: Amit Murthy Date: Wed, 5 Aug 2015 11:52:21 +0530 Subject: [PATCH] added [] operator for remoteref --- base/multi.jl | 1 + test/parallel.jl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/base/multi.jl b/base/multi.jl index 85801a1576509..aa797d54ffbc1 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -1653,6 +1653,7 @@ function terminate_all_workers() end end +getindex(r::RemoteRef) = fetch(r) function getindex(r::RemoteRef, args...) if r.where == myid() return getindex(fetch(r), args...) diff --git a/test/parallel.jl b/test/parallel.jl index e413d3a53cac2..b3c3a2aa2eff3 100644 --- a/test/parallel.jl +++ b/test/parallel.jl @@ -18,11 +18,13 @@ rr=RemoteRef() a = rand(5,5) put!(rr, a) @test rr[2,3] == a[2,3] +@test rr[] == a rr=RemoteRef(workers()[1]) a = rand(5,5) put!(rr, a) @test rr[1,5] == a[1,5] +@test rr[] == a dims = (20,20,20)