Alexandre Ferrieux | 25 Sep 17:06

TIP #332: Half-Close for Bidirectional Channels


 TIP #332: HALF-CLOSE FOR BIDIRECTIONAL CHANNELS 
=================================================
 Version:      $Revision: 1.1 $
 Author:       Alexandre Ferrieux <alexandre.ferrieux_at_gmail.com>
 State:        Draft
 Type:         Project
 Tcl-Version:  8.6
 Vote:         Pending
 Created:      Thursday, 25 September 2008
 URL:          http://purl.org/tcl/tip/332.html
 WebEdit:      http://purl.org/tcl/tip/edit/332
 Post-History: 
 Obsoletes:    TIP #301

-------------------------------------------------------------------------

 ABSTRACT 
==========

 This TIP proposes to extend the *close*/*chan close* commands to let 
 them perform an unidirectional "half-close" on bidirectional channels. 

 BACKGROUND 
============

 Bidirectional channels (sockets and command pipelines) allow Tcl to 
 make an efficient use of a "filter process", by exchanging data back 
 and forth over an abstract "single" channel. 

(Continue reading)

Alexandre Ferrieux | 26 Sep 00:29

Re: TIP #332: Half-Close for Bidirectional Channels

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 :-)
(Continue reading)

Stuart Cassoff | 4 Oct 17:59

Re: TIP #332: Half-Close for Bidirectional Channels

Alexandre Ferrieux wrote:
> 
> 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 ?
> 

What about [eof] ?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Alexandre Ferrieux | 5 Oct 15:56

Re: TIP #332: Half-Close for Bidirectional Channels

On Sat, Oct 4, 2008 at 5:59 PM, Stuart Cassoff <aa72aa60@...> wrote:
> Alexandre Ferrieux wrote:
>>
>> 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 ?
>>
>
> What about [eof] ?

Well, [eof] is not the hardest part. Actually the generic part of
[close] itself is a bit involved because of the stacked channel
system.
But you're right, the system part is not "all there is left" (it is
even the simplest part :-)

-Alex

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane