>>>>> "ew" == Edi Weitz <[EMAIL PROTECTED]> writes:

  ew> Is it possible to save a core with a multi-processing function that
  ew> automatically starts up when the core is loaded (on x86)? I want to
  ew> deliver an app to a customer of mine who isn't Lisp-savvy and I
  ew> thought giving him a core and a shell script to start CMUCL with this
  ew> core would be the best option (I have done this before successfully
  ew> with single-process applications).

there are two things to look out for: (i) your init-function should return
an integer that will be the Unix exit code; (ii) your init-function
should set up a catch block for %END-OF-THE-WORLD, since this is used
by CMUCL's internal error handling machinery.

One way of achieving what you want is 

,----
|   (defun foo ()
|     (loop for i below 10
|           do (print i) (sleep .5))
|     (ext:quit))
| 
|   (defun bar ()
|     (catch 'lisp::%end-of-the-world
|       (mp::init-multi-processing)
|       (mp:make-process #'foo)
|       (mp:make-process #'foo)
|       (mp::idle-process-loop)))
`----

Any process that calls EXT:QUIT will cleanly terminate the
application. The IDLE-PROCESS-LOOP looks after calling the serve-event
handlers for you.

  
  ew> Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
  ew> #<Process Anonymous {480516D5}> is not of type (SIGNED-BYTE 32)

this is because the init-function must return a Unix exit code, but in
your example it is returning a process.

  ew> (mp::startup-idle-and-top-level-loops)
  ew> 
  ew> as the first form to BAR. I now get a compile-time message like
  ew> 
  ew> ; In: LAMBDA NIL
  ew> 
  ew> ;   (MULTIPROCESSING:MAKE-PROCESS #'FOO)
  ew> ; Note: Deleting unreachable code.

that's because the compiler knows that S-I-A-T-L-L does not return.

-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>

Reply via email to