Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (33 sloc) 0.772 kB
show(t::Task) = print("Task")
# task-local storage
function tls()
t = current_task()
if is(t.tls, nothing)
t.tls = IdTable()
end
(t.tls)::IdTable
end
function tls(key)
tls()[key]
end
function tls(key, val)
tls()[key] = val
end
let _generator_stack = {}
global produce, consume
function produce(v)
caller = pop(_generator_stack::Array{Any,1})
yieldto(caller, v)
end
function consume(G::Task, args...)
push(_generator_stack::Array{Any,1}, current_task())
v = yieldto(G, args...)
if istaskdone(G)
pop(_generator_stack::Array{Any,1})
end
v
end
end
start(t::Task) = consume(t)
done(t::Task, val) = istaskdone(t)
next(t::Task, val) = (val, consume(t))
Jump to Line
Something went wrong with that request. Please try again.