Jerry <xwindow@yahoo.com> wrote in message news:b0iasq$lu3$1@inn.qnx.com…
“Xiaodan Tang” <> xtang@qnx.com> > wrote in message
news:b0ib13$ec9$> 1@nntp.qnx.com> …
Jerry <> xwindow@yahoo.com> > wrote in message
news:b0i594$g16$> 1@inn.qnx.com> …
The document about the flag _NTO_CHF_COID_DISCONNECT is
not very clear. When I turned to Robert Krten’s book, the description
about this flag also made me confused.
Who could explain this flag in an easy-to-understand way, an example
would be very useful.
Assume process A calls ChannelCreate() with this flag set, process B
connects
this channel by calling ConnectAttach().
What is the difference between two cases (with and without this flag)?
Thanks.
When B calles ConnectAttach(), it got back a “connection id”. Actually,
a “server side connection id” (scoid) also created in Process A to
identify
the same connection.
Without the flag, if B ConnectDetach(coid), or crashed, or being killed
by some sort of signal, A will never know, and have the scoid opened.
With the flag, anytime B gone, A got nitified (with a pulse, and scoid
in
pulse), A could then call ConnectDetach(scoid) to free the scoid.
-xtang
I thought the flag _NTO_CHF_DISCONNECT does what you said.
then what is difference between _NTO_CHF_DISCONNECT and
_NTO_CHF_COID_DISCONNECT?
Oops. Sorry for that. the _NTO_CHF_COID_DISCONNECT is the
otherway arround. Let’s try it again.
A ChannelCreate() and B ConnectAttach() to it, what happens if A
crashed, or it simply called ChannelDestroy() ? B wouldn’t get informed.
(B could call MsgSend() and try to hit a ESRCH or EBADF, but
that’s not for sure.)
What B would do is, it will ChannelCreate(_NTO_CHF_COID_DISCONNECT)
(note only one channel in a process allowed to set this flag). B will then
have a thread MsgReceive() on the channel to get the notification
that A is died…
Does this make sense now ?
-xtang