[Openmcl-devel] Cockpit Error using SAVE-APPLICATION?

Gary Byers gb at clozure.com
Thu Nov 6 16:19:58 PST 2008


At one point in the not-too-recent past, it was

a) necessary to to do CALL-NEXT-METHOD in the CCL::TOPLEVEL-FUNCTION
method on a subclass of CCL::LISP-DEVELOPMENT-SYSTEM, because that
was the only way of ensuring that all of the low-level initialization
stuff happened
b) impossible to do so usefully, since the next method started a
REPL and never returned.

I think that that's fixed (in that the initialization happens in
the :before method on CCL::APPLICATION and it's no longer necessary
to call the next primary method, but it's probably fair to say that
some of this stuff should be refactored and redesigned so that it's
a little harder to lose.

As far as your code goes:

I think that it's still true that your function will run on the initial
thread.  If that code writes to *TERMINAL-IO*, output to that stream
may need to be explicitly flushed (via FORCE-OUTPUT).

The single thread will own the right to read from the input side of
*TERMINAL-IO*.

^C/SIGINT processing is based on the idea that someting checking
"often enough, but not hysterically often" to see if a flag set
by a low-level signal handler that runs in response to the interrupt
signal is set.

You can get that (and the automatic flushing of output to *TERMINAL-IO*)
to happen by starting a thread to run CCL::HOUSEKEEPING-LOOP.  That
wont add too much overhead (the thread will spend 99+% of its time
sleeping.)

(defmethod ccl::toplevel-function ((a aprigo-application) x)
  (declare (ignore x))
  (load "init") ; Init stuff, could be done differently of course
  (PROCESS-RUN-FUNCTION "background" #'CCL::HOUSEKEEPING-LOOP)
  (loop
    (sleep 1000))
  (quit))

Ideally, it'd be possible to easily define -some- methods on
a subclass of CCL::LISP-DEVELOPMENT-SYSTEM so that everything
but the invocation of the REPL happened via the superclass's
methods and you just ran some other code instead of the
REPL.  (That's very nearly what happens via the --eval approach.)

On Thu, 6 Nov 2008, j-anthony at comcast.net wrote:

>
> As an FYI, this:
>
>> So, basically a reasonable alternative approach (even given the current
>> state of it's development) would be to subclass off APPLICATION (or perhaps
>> LISP-DEVELOPMENT-SYSTEM) and define a toplevel-function method on this and
>> then not pass in a :toplevel-function.  This would then cause the :before
>> methods to run and such and invoke the specific toplevel-function method
>> which would "do whatever".  Make sense?
>
> works quite well modulo the use of non exported (and so a bit dodgy)
> symbols from CCL.
>
>
> (defclass aprigo-application (ccl::lisp-development-system) ())
>
> (defmethod ccl::toplevel-function ((a aprigo-application) x)
>  (declare (ignore x))
>  (load "init") ; Init stuff, could be done differently of course
>  (loop
>    (sleep 1000))
>  (quit))
>
> (save-application
>  "/var/aprigo/Persistence/persistence.lx64"
>  :application-class 'aprigo-application))
>
> -----
>
> ccl -I persistence.lx64
>
> and it just works.  Any bomb here that I may be grossly overlooking
>
>
> /Jon
>
>
>
> --------------------------------------------------------------------
> mail2web.com – What can On Demand Business Solutions do for you?
> http://link.mail2web.com/Business/SharePoint
>
>
>


More information about the Openmcl-devel mailing list