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

Task() constructed in loop doesn't work (only the last task is created) #3517

Closed
swadey opened this issue Jun 24, 2013 · 2 comments
Closed

Comments

@swadey
Copy link
Contributor

swadey commented Jun 24, 2013

Defined outside of loops:

julia> t = Task(() -> produce(1))
julia> t2 = Task(() -> produce(2))
julia> consume(t)
1
julia> consume(t2)
2

Defined within a loop:

julia> x = {}
julia> for i = 1:10 push!(x, Task(() -> produce(i))) end
julia> x
10-element Any Array:
Task
Task
Task
Task
Task
Task
Task
Task
Task
Task
julia> consume(x[1])
10
julia> consume(x[2])
10
julia> consume(x[3])
10
julia> consume(x[4])
10
julia> consume(x[5])
...

@johnmyleswhite
Copy link
Member

This is a dup of issues related to creating new bindings for each iteration of a for loop. I'm also hitting this since the changes to let mean that my Bloom filter code is now broken.

@JeffBezanson
Copy link
Sponsor Member

dup of #1571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants