/* -*-C-*-
-$Id: prosio.c,v 1.31 2009/03/21 07:09:09 riastradh Exp $
+$Id: prosio.c,v 1.32 2009/04/15 19:30:52 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
: (BOOLEAN_TO_OBJECT (result == 0)));
}
}
-
+\f
DEFINE_PRIMITIVE ("CHANNEL-NONBLOCKING", Prim_channel_nonblocking, 1, 1,
"Put CHANNEL in non-blocking mode.")
{
PRIMITIVE_RETURN (result);
}
}
+
+DEFINE_PRIMITIVE ("NEW-MAKE-PIPE", Prim_new_make_pipe, 2, 2,
+ "Store the reader and writer of a new pipe in the cdrs of weak pairs.")
+{
+ PRIMITIVE_HEADER (2);
+ CHECK_ARG (1, WEAK_PAIR_P);
+ CHECK_ARG (2, WEAK_PAIR_P);
+ {
+ Tchannel reader;
+ Tchannel writer;
+ OS_make_pipe ((&reader), (&writer));
+ SET_PAIR_CDR ((ARG_REF (1)), (long_to_integer (reader)));
+ SET_PAIR_CDR ((ARG_REF (2)), (long_to_integer (writer)));
+ PRIMITIVE_RETURN (UNSPECIFIC);
+ }
+}
\f
/* Select registry */
#| -*-Scheme-*-
-$Id: io.scm,v 14.89 2009/03/21 07:09:09 riastradh Exp $
+$Id: io.scm,v 14.90 2009/04/15 19:30:53 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
((ucode-primitive file-truncate 2) (channel-descriptor channel) length))
(define (make-pipe)
- (without-interrupts
- (lambda ()
- (let ((pipe ((ucode-primitive make-pipe 0))))
- (values (make-channel (car pipe))
- (make-channel (cdr pipe)))))))
+ (let* ((writer)
+ (reader
+ (open-channel
+ (lambda (reader-pair)
+ (set! writer
+ (open-channel
+ (lambda (writer-pair)
+ ((ucode-primitive new-make-pipe 2)
+ reader-pair
+ writer-pair))))))))
+ (values reader writer)))
\f
;;;; Terminal Primitives