Task objects, which are created by @task f(args), hold on to some
resources. How do those resources get released?
For example, if I have a function that makes a task that doesn't return,
what happens?
function doforever()
while true
produce(true)
end
end
function g(n::Int)
t = @task doforever()
for i in 1:n
return consume(t)
end
end
for i in 1:10000
g(5)
end
How many tasks are still in existence at the end of this loop?
Do the resources associated with a task get released as soon as all
references to the Task instance go out of scope?
Does the task need to be "done" before releasing the resources?
I expect the answers to be 1 (the main task), yes (at first available gc
cycle), no.
The docs page http://docs.julialang.org/en/release-0.4/stdlib/parallel/
doesn't really cover these issues so I am not sure.
Also is there a reference that details what resources Task instances
possess?