[Openmcl-devel] sharing in external-process streams

Osei Poku osei.poku at gmail.com
Thu Nov 20 07:17:39 PST 2008


Ah.. another way to skin the same cat :)

On Nov 20, 2008, at 10:10 AM, Daniel Dickison wrote:

> Check out ticket 216: I think this is the same issue.  I attached a  
> patch to that bug that solves this in a different way, namely by  
> adding a :sharing argument to process-run-function, which seems a  
> bit more consistent with the other options available for the  
> external processes API (but I don't feel strongly about it either  
> way).
> http://trac.clozure.com/openmcl/ticket/216
>
> Daniel
>
> On Nov 20, 2008, at 10:00 AM, Osei Poku wrote:
>
>> 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)
>>
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
>




More information about the Openmcl-devel mailing list