[Openmcl-devel] sharing in external-process streams

Osei Poku osei.poku at gmail.com
Thu Nov 20 07:00:48 PST 2008


Hi,

The attached diff was my solution for allowing customization of  
the :sharing keyword when creating input and output streams for  
external processes.

The problem I was trying to solve was not being able to read and/or  
write on the streams that are created for external-processes when  
using :stream for the :input and :output keyword arguments.  In  
particular, any reading and writing from threads that did not create  
the external-process failed due the the streams defaulting as :private  
to the creating thread.

Comments?

Osei

Index: level-1/linux-files.lisp
===================================================================
--- level-1/linux-files.lisp    (revision 10465)
+++ level-1/linux-files.lisp    (working copy)
@@ -766,6 +766,8 @@
         (format stream " : ~d" (external-process-%exit-code p)))
        (format stream ")"))))

+(defvar *external-process-sharing* :private)
+
  (defun get-descriptor-for (object proc close-in-parent close-on-error
                                   &rest keys &key direction (element- 
type 'character)
                                   &allow-other-keys)
@@ -789,6 +791,7 @@
                                   :direction :output
                                    :element-type element-type
                                   :interactive nil
+                                 :sharing *external-process-sharing*
                                    :basic t
                                    :auto-close t)
                   (cons read-pipe close-in-parent)
@@ -798,6 +801,7 @@
                   (make-fd-stream read-pipe
                                   :direction :input
                                    :element-type element-type
+                                 :sharing *external-process-sharing*
                                   :interactive nil
                                    :basic t
                                    :auto-close t)




More information about the Openmcl-devel mailing list