Skip to content
This repository was archived by the owner on May 4, 2018. It is now read-only.

uv_read_start return value and read_cb #944

Closed
klutzy opened this issue Oct 2, 2013 · 2 comments
Closed

uv_read_start return value and read_cb #944

klutzy opened this issue Oct 2, 2013 · 2 comments

Comments

@klutzy
Copy link

klutzy commented Oct 2, 2013

Hello! When I was debugging Rust, I found uv_read_start may not call read_cb in some cases. Since Rust's I/O currently utilizes callback for scheduling, it is critical to know whether read_cb is called by uv or not.

Initially I guessed that the return value from uv_read_start indicates whether read_cb is called or not. However, it is not true on win32: it returns zero for tty if it has UV_HANDLE_READ_PENDING flag.

So I now think: return value only means that there was no critical error, not necessarily that read_cb has been called. Is it right? Then I'm also curious if there is a way to know it.

@bnoordhuis
Copy link
Contributor

So I now think: return value only means that there was no critical error, not necessarily that read_cb has been called. Is it right?

That's correct. uv_read_start() merely tells libuv to start listening for incoming data. If or when your callback is invoked is indeterminate but it will be at least one event loop tick in the future. Does that answer your question?

@klutzy
Copy link
Author

klutzy commented Oct 2, 2013

It is now clear to me. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants