From 44e6c9cc8b4b49a9006d64d3ae56f901ab79cb66 Mon Sep 17 00:00:00 2001 From: tan Date: Mon, 7 Apr 2014 11:20:22 +0530 Subject: [PATCH] task iter does not consume in done call. fixes #6447 --- base/task.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/base/task.jl b/base/task.jl index e0099aa3fd883..efad2d0d2dcf1 100644 --- a/base/task.jl +++ b/base/task.jl @@ -162,12 +162,13 @@ function consume(P::Task, values...) schedule_and_wait(P) end -start(t::Task) = nothing -function done(t::Task, val) +start(t::Task) = (istaskstarted(t) || (t.result = consume(t)); return nothing) +done(t::Task, val) = istaskdone(t) +function next(t::Task, val) + result = t.result t.result = consume(t) - istaskdone(t) + (result, nothing) end -next(t::Task, val) = (t.result, nothing) ## condition variables