Re: Questions about multiprocessing
At 27/04/2005 17:28, davef@lispworks.com wrote:
> > > > How to create a new process that has its own listener window (or console)?
> > >
> > >For a listener window, display a CAPI interface that includes
> > >CAPI:LISTENER-PANE/
> > >http://www.lispworks.com/documentation/lw445/CAPRM/html/capiref-174.htm
> > >
> > >For a Windows console window (if that's what you mean) check the
> > >documentation of SAVE-IMAGE, in particular the :CONSOLE argument.
> > >http://www.lispworks.com/documentation/lw445/LWRM/html/lwref-214.htm
> >
> > Actually I had seen CAPI:LISTENER-PANE in the documentation but
> > was looking for a more immediate solution (I have not yet practiced CAPI).
> >
> > I also have seen lispworks:start-tty-listener which could be
> > sufficient to me if it is possible to specify variables to be
> > initially bound in the process started by start-tty-listener
> > (especially *read-table* and IO variables). Is this possible?
>
>If you already have a console window then this does what I think you
>want:
>
>(let ((mp:*process-initial-bindings*
> (cons (cons 'greeting "Hi Francis")
> mp:*process-initial-bindings*)))
> (start-tty-listener))
>
>Get a console window in LispWorks by specifying the :CONSOLE argument
>when you save a LispWorks image, or by the handy trick
>
> (READ-LINE *TERMINAL-IO*)
I take both!
> >
> > > > What are the purpose of the variables in
> > > > mp:*process-initial-bindings*?
> > >
> > >These have various purposes.
> > >
> > > > Are these bindings always required
> > > > when creating a new process? Or should some of them been
> > > removed in some situations?
> > >
> > >The MP::*ACTIONS-BEFORE-SLEEPING* binding is essential.
> > >
> > >Otherwise, each binding is essential or otherwise depending what the
> > >process does. For example, if it uses the editor, then you definitely
> > >need the EDITOR::*EDITOR-INPUT-STYLE* binding. If it reads, well then
> > >the SYS::*READER-STATE* binding is useful.
> > >
> > >I don't see any real harm in leaving all these bindings as-is and
> > >simply appending to the list as in the examples in the LispWorks
> > >Reference Manual. (Do you?)
> >
> > Not really. I got into difficulties with tracing some functions
> > in a process I started. I looked in mp:*process-initial-bindings*
> > before I realize I was trying to trace a function object. 3 years
> > without programming in Lisp, I'm almost turned into a beginner again :-(
>
>Some Common Lisp implementations do trace function objects, whereas
>LispWorks traces only the symbol (or SETF name), so it could be that
>you are remembering implementation-specific behavior, and have not
>forgotten anything really :)
>
> > BTW, what is the LW common way to "spy" a function object like
> > the one in the following example? Is it defadvice?
>
>No, DEFADVICE has the same restriction.
>
> > (defun bar () :bar)
> >
> > (defstruct container ()
> > (function-object))
> >
> > (defvar *c (make-container
> > :function-object (fdefinition 'bar)))
> >
> > (funcall (container-function-object *c))
>
>I would probably just put a print statement in BAR though you might
>want to use something like this:
>
> (trace (funcall :when (eq (car *traced-arglist*) (fdefinition 'bar)))
> (apply :when (eq (car *traced-arglist*) (fdefinition 'bar))))
This too!
Thanks Dave,
Francis
>__
>Dave Fox
>LispWorks Ltd
>St John's Innovation Centre
>Cowley Road
>Cambridge
>CB4 0WS
>England
>
>+44 1223 421861
>
>
>______________________________________________________________________
>This email has been scanned by the MessageLabs Email Security System.
>For more information please visit http://www.messagelabs.com/email
>______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________