> What I am really shooting for a is method to query a socket to
> see if there is any data available for reading and if not, go do something
> else for awhile.

Rust has tasks so you can just spawn a task to handle the socket reads
and do other stuff while it's blocking in other tasks. The
non-blocking stuff happens for you behind the scenes by the task
scheduler. In Erlang, you normally just make all your blocking calls
in a process (the Erlang version of Rust tasks) and don't worry about
it. Erlang's gen_tcp:recv does have a mode where it will return
immediately with any available data, but I've never used it, and I
don't believe its use is common.

jack.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to