Skip to content

Commit

Permalink
added [] operator for remoteref
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy committed Aug 5, 2015
1 parent e66175b commit ea93736
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
2 changes: 2 additions & 0 deletions test/parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit ea93736

Please sign in to comment.