cfunction
src/core/ev.c on line 1286 , column 1
(ev/chan &opt capacity )
Create a new channel. capacity is the number of values to queue
before blocking writers , defaults to 0 if not provided. Returns a
new channel.
# create a channel without buffer, default is 0
(def channel (ev/chan ))
(ev/spawn
(ev/sleep 5 )
(ev/give channel "Hard work is done!" ))
(print "do anything" )
(for i 0 5
(print i )
(ev/sleep 0.5 ))
(print (ev/take channel )) # blocks here, until there is a result in the channel
(print "done" )