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 iter does not consume in done call. fixes #6447 #6448

Closed
wants to merge 1 commit into from

Conversation

tanmaykm
Copy link
Member

@tanmaykm tanmaykm commented Apr 7, 2014

This changes the iterator for Task to consume only in start and next calls.
The istaskstarted check in start is to allow it to be called multiple times from isempty.

@JeffBezanson
Copy link
Member

This would be a nice change, but similar to the solutions proposed in #6125 it has the problem that the task runs twice before the consumer sees the first value, which is unexpected control flow.

I'm not sure isempty is meaningful for tasks. Should its value change over time, or should it mean "did/does this task produce any values?"

@micklat
Copy link
Contributor

micklat commented Apr 7, 2014

How about raising an error in isempty(t::Task)?

@tanmaykm
Copy link
Member Author

tanmaykm commented Apr 7, 2014

Yes, this too does not prevent the producer from running one step ahead. Having nextval and nextstate seems to be the right thing to do?

@JeffBezanson
Copy link
Member

Yes, in this case you really want nextval and nextstate. Unfortunately there are other problems with iterators that are not fully solved by that change, but perhaps we should still consider it.

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

Successfully merging this pull request may close these issues.

3 participants