[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pipelining streams



    Date: Thu, 22 Oct 87 10:26 PDT
    From: Christopher Garrigues <7thSon@SPAR-20.ARPA>
    [Added customer-reports since there are bugs here]
Customer reports:  All bugs reported are already fixed in 7.2.

    I was going to suggest:
    
    
    (defun 1pipeline0 (f1 f2)
      (funcall f1 (si:make-coroutine-input-stream f2)))
    
    but, first off, 1si:make-coroutine-input-stream0 seems to have been moved
    from SI to CLI without anybody telling the documetnation department, 
[Maybe they sent it to bug-documetnation <:=]

Already fixed; they're in 1sys:0 in 7.2.  (1si:0 inherits from 1sys:0)
There's a new, much easier to use (and type) function:
1sys:open-coroutine-stream0, which takes keyword arguments.
I sent a version that will work with 7.1 in my earlier reply.
									 and
    secondly, it doesn't work.  

It "works fine"; it just creates 1(unsigned-byte 8)0 streams.  But I'm
sure not going to defend that choice what one kind of stream to support!
I think it was probably a thinko on the part of someone trying to be
compatible with Release 6.  1sys:open-coroutine-stream0 lets you specify
the 1:element-type0 keyword.

				using 1cli::make-coroutine-input-stream
0    rather than 1si:make-coroutine-input-stream0 will work with the following
    patch:

Of course this breaks anything which is using them to create byte
streams.  (Any bets as to how many people have used them for that?)
Use my new function instead, and you should be all set for 7.2.
    
    I also note that there's undocumented code in the same file for "pipes",

I noticed earlier that they weren't documented, and sent in a
request for them to be documented.  I offered to create a new
function, 1sys:open-pipe-stream0, parallel to 1sys:open-coroutine-stream0,
so they'd only have to document one function; I should be able
to get that through patch review.  Of course, this should not be
taken as a committment by Symbolics to provide any particular
feature... <:=)

    but in 2 minutes of playing, I couldn't make them work.  I tried this:
    
    (defun 1pipeline20 (f1 f2)
      (multiple-value-bind (s1 s2)
	  (sys:make-unidirectional-pipe)
	(while-in-background "Run background function"
	  (funcall f2 s2))
	(funcall f1 s1)))

You forgot to do 1:force-output0 -- these are buffered streams.

(defun 1pipeline30 (f1 f2)
  (multiple-value-bind (s1 s2)
      (sys:make-unidirectional-pipe)
    (while-in-background "Run background function"
       (funcall f2 s2)
       1(send s2 :force-output)0)
    (funcall f1 s1)))

Of course, a 1close0 will also do the trick.

    where 1while-in-background0 is a local hack.  ~shrug~  There's also this
    comment in the file 2above0 the code for pipes:
    
    ;; Improvements to be made to the above:
    ;;   COROUTINE-STREAM-FOOTHOLD should set up a restart handler which aborts
    ;;     back to the initial stack group.
    ;;   Handle other stack group states
    ;;   Implement pipes
The comment is fixed in 7.2, as is the lack of restart handler, and
things have been cleaned up in general.  (I didn't do it, but I guess
I can stop tracking it at last!)

Thank you for your report.  Say hello to the kitties.