This is my idea
task=@task begin
while true
sleep(1)
foo()
if should_end
# ?
end
end
end
But
- are there any simple ways to contact other than using
global should_end
? - how to end the task from inside the expression?
P.S.
The problem is solved in an answer in stackoverflow.