views:

26

answers:

1

In order to run a CLIM UI, the generic function clim:run-frame-top-level must be invoked, however this function blocks until the UI exits. This would seem to require all application control be handled via the CLIM top level.

Is it possible to structure an application differently such that a control-flow outside of the CLIM top level is established and which simply interacts with the application-frame as needed?

+3  A: 

Most Common Lisp implementations that support CLIM have a way to run functions as a separate thread (usually called a PROCESS in Lisp).

In many Common Lisp implementations this function is called PROCESS-RUN-FUNCTION. See the documentation of your Lisp.

CLIM itself has a function MAKE-PROCESS. This is implementation independent and works on CLIM implementations on top of a multithreaded Lisp like Allegro CL, LispWorks, MCL, Genera, ...

Something like (example in the CLIM-USER package).

(make-process (lambda () (run-frame-top-level ...)))

should run the toplevel in its own thread.

This would allow you to run multiple frames, have other Lisp processes with REPLs, etc.

Rainer Joswig
Wonderful -- thanks for the help!
Thank you again! Now that I know about make-process (in the clim-sys package) I found an example of running a clim UI asynchronously using locks to share state between the processes in the mcclim examples: stopwatch.lisp.