Hello, Every pending callback will be called with UV_ECANCELED *prior to* calling close_cb.
Don't be worried ;) Thank you, Fedor. On Wed, Jun 1, 2016 at 12:33 AM, Darren Smith <[email protected]> wrote: > Hi > > To close a libuv tcp socket, I understand that I need to call uv_close( > handle ) and then expect to have the close_cb() callback invoked by its > uv_loop sometime later. > > My concern is what may happen to pending in-progress write requests, > started prior to the call to uv_close. The documentation explains that > they will be cancelled and have their write_cb callback called > with status=UV_ECANCELED. What I'm not sure of is whether these > write-cancelled callbacks can arrive after the close_cb callback. > > The reason I care about this is that I'm using both callbacks to send > events to a user object; I'd like the close_cb callback to signify the > meaning, "no more libuv callbacks for this object", thus allowing the > object to be deleted. However doing that delete would be unsafe if a later > write_cb(UV_ECANCELED) might arrive and leads to delivering a write-failed > event to same user object. > > So is there any guarantee of callback ordering for uv_write & uv_close > callbacks? > > Thanks, > > Darren > > -- > 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 https://groups.google.com/group/libuv. > For more options, visit https://groups.google.com/d/optout. > -- 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 https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
