reading bytes and blocking

12 views
Skip to first unread message

John Merlino

unread,
Oct 30, 2012, 12:20:17 PM10/30/12
to Ruby on Rails: Talk
I come across this method:

read(n=nil, buffer=nil) – read n bytes (or fewer, if EOF is reached),
blocking if necessary, until the bytes are ready.

What does it mean "blocking if necessary"? Blocking what?

Colin Law

unread,
Oct 30, 2012, 12:23:28 PM10/30/12
to rubyonra...@googlegroups.com
It means that if it is reading from a keyboard for example it will
wait (block) for data to be input if there is nothing available. A
non-blocking read will just pick up whatever data is available and
immediately return.

Colin

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages