Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function linearWrapper(f::Function, proc::Channel)
- take!(proc)
- f()
- put!(proc, 1)
- end
- function f()
- print("Running f\n")
- end
- function g()
- print("Running g\n")
- end
- function h()
- print("Running h\n")
- end
- p = Channel(32)
- put!(p, 1)
- @async linearWrapper(f, p)
- @async linearWrapper(g, p)
- @async linearWrapper(h, p)
- while true
- yield()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement