Skip to content

Commit

Permalink
Fix RemoteChannel iterator interface (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwe authored Jul 19, 2024
1 parent f4aaf1b commit 8e3f849
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Distributed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using Base: Process, Semaphore, JLOptions, buffer_writes, @async_unwrap,
julia_cmd, AsyncGenerator, acquire, release, invokelatest,
shell_escape_posixly, shell_escape_csh,
shell_escape_wincmd, escape_microsoft_c_args,
uv_error, something, notnothing, isbuffered, mapany
uv_error, something, notnothing, isbuffered, mapany, SizeUnknown
using Base.Threads: Event

using Serialization, Sockets
Expand Down
8 changes: 8 additions & 0 deletions test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ test_iteration(RemoteChannel(() -> Channel(10)), RemoteChannel(() -> Channel(10)
return count
end

@everywhere test_iteration_collect(ch) = length(collect(ch))

@everywhere function test_iteration_put(ch, total)
for i in 1:total
put!(ch, i)
Expand All @@ -483,10 +485,16 @@ end
let ch = RemoteChannel(() -> Channel(1))
@async test_iteration_put(ch, 10)
@test 10 == @fetchfrom id_other test_iteration_take(ch)
ch = RemoteChannel(() -> Channel(1))
@async test_iteration_put(ch, 10)
@test 10 == @fetchfrom id_other test_iteration_collect(ch)
# now reverse
ch = RemoteChannel(() -> Channel(1))
@spawnat id_other test_iteration_put(ch, 10)
@test 10 == test_iteration_take(ch)
ch = RemoteChannel(() -> Channel(1))
@spawnat id_other test_iteration_put(ch, 10)
@test 10 == test_iteration_collect(ch)
end

# make sure exceptions propagate when waiting on Tasks
Expand Down

0 comments on commit 8e3f849

Please sign in to comment.