Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RemoteChannel iterator interface #100

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading