Hello,
Firstly I would like to thank everyone in helping me out with the
Multiprocessing problems that I had before
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00128.html

Thank you,

I see another roadblock in my code...

I wrote a lisp function that basically starts a server like this

(defun server2 (&optional (port 1111))
  (labels (
           ;; The session top level eval
           (start-top-level (fd)
                            (let ((stream (sys:make-fd-stream fd :input t
:output t)))
                              (unwind-protect
                                  (progn
                                    (analyze stream)
                                    (close stream))
                                (handler-case
                                 (close stream)
                                 (error ())))))
           ;; The body of the TCP listener.
           (listener ()
                     (let ((fd nil))
                       (unwind-protect
                           (progn
                             ;; Start the listener.
                             (do ()
                                 (fd)
                               (handler-case
                                (setf fd (ext:create-inet-listener port))
                                (error ()
                                       (progn
                                         (format t "Couldnt Start
Server~%~%")
                                         (quit)))))
                             (loop
                              ;; Wait for new connections.
                              (mp:process-wait-until-fd-usable fd :input)
                              (if (< (length (mp:all-processes)) (+ 2
*max-threads-analyze*))
                                  (progn
                                    (multiple-value-bind (new-fd)
                                      (ext:accept-tcp-connection fd)
                                      (mp:make-process #'(lambda ()
(start-top-level new-fd)) :name "Analyzer")))
                                (progn
                                  (unix:unix-close fd)))))
                         ;; Close the listener stream.
                         (when fd
                           (unix:unix-close fd))))))
    (mp:make-process #'listener)))

...

The problem however is that I cant send this process to the background (or
rather I would like to say I dont know how to do it)

if i start a lisp process like
/usr/bin/lisp -noinit -quiet -load "some-file.lisp"

some-file.lisp jsut contains
(server2)

It runs ...but crashes as soon as i press something inside teh same
terminal window...

how do i start cmucl (without entering the interactive session)
(server2) works from a lisp listener
it returns back to the lisp prompt (multiproc works perfectly)

I even tried compiling all files and using perl to run a process using
Proc::Simple ...

what will fix this ..can someone please help me out here..


Ideally I would like to do something like this from shell


#start-server
#

start-server can be a shell-script for example (the main thing is that it
should return back to the shell prompt...right now if i do this

#start-server
* (quit)
#

it comes to the lisp listener (with the server running but i cant quit to
shell without shutting lisp

if i do a ctrl-z it stops lisp listener (even if i send it to bg)



thanx

Murali




Reply via email to