Skip to content

Commit 8e3f849

Browse files
authored
Fix RemoteChannel iterator interface (#100)
1 parent f4aaf1b commit 8e3f849

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Distributed.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using Base: Process, Semaphore, JLOptions, buffer_writes, @async_unwrap,
1515
julia_cmd, AsyncGenerator, acquire, release, invokelatest,
1616
shell_escape_posixly, shell_escape_csh,
1717
shell_escape_wincmd, escape_microsoft_c_args,
18-
uv_error, something, notnothing, isbuffered, mapany
18+
uv_error, something, notnothing, isbuffered, mapany, SizeUnknown
1919
using Base.Threads: Event
2020

2121
using Serialization, Sockets

test/distributed_exec.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ test_iteration(RemoteChannel(() -> Channel(10)), RemoteChannel(() -> Channel(10)
473473
return count
474474
end
475475

476+
@everywhere test_iteration_collect(ch) = length(collect(ch))
477+
476478
@everywhere function test_iteration_put(ch, total)
477479
for i in 1:total
478480
put!(ch, i)
@@ -483,10 +485,16 @@ end
483485
let ch = RemoteChannel(() -> Channel(1))
484486
@async test_iteration_put(ch, 10)
485487
@test 10 == @fetchfrom id_other test_iteration_take(ch)
488+
ch = RemoteChannel(() -> Channel(1))
489+
@async test_iteration_put(ch, 10)
490+
@test 10 == @fetchfrom id_other test_iteration_collect(ch)
486491
# now reverse
487492
ch = RemoteChannel(() -> Channel(1))
488493
@spawnat id_other test_iteration_put(ch, 10)
489494
@test 10 == test_iteration_take(ch)
495+
ch = RemoteChannel(() -> Channel(1))
496+
@spawnat id_other test_iteration_put(ch, 10)
497+
@test 10 == test_iteration_collect(ch)
490498
end
491499

492500
# make sure exceptions propagate when waiting on Tasks

0 commit comments

Comments
 (0)