Skip to content

consume never returns if task function doesn't contain produce #41

@yebai

Description

@yebai

The following code would halt

using Libtask

function f_ct()
   t = 0;
   while t<3
     println(t)
     t = 1 + t
   end
   return t
end

t = CTask(f_ct)

julia> consume(t) # Never returns. 
0
1
2

This is likely due to the consumer task never gets waken up if the producer task exit before any produce statement. Maybe a better behaviour for this kind of tasks is to wake up the producer task with the producer task's return value?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions