On 4/17/14 7:50 PM, Susheel Aroskar wrote:
Suppose I have uv_tcp_t handle from properly established connection. I
have both read and write calls pending on this handle by having called
uv_read_start() and uv_write() using the same tcp handle. Now for some
reason I decide to close the original tcp handle by calling uv_close()
on it. I know in this case both uv_read_cb and uv_write_cb will be
eventually called with UV_ECANCELLED or UV_EINTR. However my question
is, is there any ordering guarantees regarding the sequence in which
these callbacks will be invoked? Particularly, can I assume uv_read_cb
and uv_write_cb will definitely be invoked before uv_close_cb is invoked
for the underlying uv_tcp_t? I want to use uv_close_cb to free some
application specific per TCP connection struct but my
uv_read_cb/uv_write_cb callbacks need some fields from that struct. So
unless uv_close_cb is guaranteed to be called last I cannot safely use
it to free the struct.
Hi,
Yes, the close callback will always be the last one to be called. This
is by design, so you can safely rely on it.
Cheers,
--
Saúl Ibarra Corretgé
http://bettercallsaghul.com
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.