-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing doc for Channel #4822
Comments
Hi, I agree that the API documentation of |
Thanks for that. But what I really need is the doc about select, and sadly, I can't find anything about that. :( In fact, I'm trying to do non-blocking interact between threads(coroutines or fibers), in go, I can just use select to get away with not useful message sent by channels. Since there is a "select" method in |
The only documentation is the PR that introduced it (#3130) and the sample (see below, taken from: samples/channel_select.cr) def generator(n : T) forall T
channel = Channel(T).new
spawn do
loop do
sleep n
channel.send n
end
end
channel
end
ch1 = generator(1)
ch2 = generator(1.5)
ch3 = generator(5)
loop do
select
when int = ch1.receive
puts "Int: #{int}"
when float = ch2.receive
puts "Float: #{float}"
when ch3.receive
break
end
end |
Thanks a lot. That should be what I'm searching for. Still hope you can fix the doc problem soon. :) |
There's a lot of missing docs. The solution here is to send a PR with the docs. I don't think we'd like to track an issue for each missing piece of doc. |
Thanks for this great project. I really love this language, and try to use it everywhere as much as I can. :)
But, I found there is doc missing in std, especially something about Channel. And I'm really confused about usage of this object.
Hope you guys can fix this soon. :)
The text was updated successfully, but these errors were encountered: