From: Alexandre F. <ale...@gm...> - 2008-09-25 22:29:19
|
On Thu, Sep 25, 2008 at 5:07 PM, I wrote: > > TIP #332: HALF-CLOSE FOR BIDIRECTIONAL CHANNELS > > REFERENCE IMPLEMENTATION > ========================== > > Coming soon, once identified the best way of minimizing the channel ABI > compatibility issue (since the half-close has to cross the generic > channel interface). > I am pleased to discover that the underlying machinery for half-closes has been there for more than 8 years ! [cvs annotate tclIO.c]: 1.21 (kupries 02-May-00): if (chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) { 1.21 (kupries 02-May-00): result = (chanPtr->typePtr->close2Proc)(chanPtr->instanceData, interp, 1.21 (kupries 02-May-00): TCL_CLOSE_READ); The reason, as I understand it by reading the code, is to be able to close the read side, then flush the write side, then close the write side. Since the flush is in the generic layer, it implies splitting the closeproc. I can imagine situations with a command pipeline where this sequence is an efficient deadlock-killer, though I'm not sure Tcl should be blamed for them... Anyway I won't complain now, I'll just pretend Andreas used his time machine in 2000 :-) So, it looks like all there's left to be done is implement a close2proc for sockets, with no ABI change ! Am I right to believe so ? -Alex |