[Openmcl-devel] Modal dialog problems with CCL 1.9 32/64 on Mountain Lion

R. Matthew Emerson rme at clozure.com
Thu Sep 6 14:25:18 PDT 2012

On Sep 6, 2012, at 4:32 PM, Alexander Repenning <Alexander.Repenning at colorado.edu> wrote:

> There is a lot of event handling code that includes Matt's in-main-thread:
> (defmacro IN-MAIN-THREAD (() &body body)
>  (let ((thunk (gensym))
>        (done (gensym))
>        (result (gensym)))
>    `(let ((,done nil)
>           (,result nil))
>       (flet ((,thunk ()
>                (setq ,result (multiple-value-list (progn , at body))
>                      ,done t)))
>         (gui::execute-in-gui #',thunk)
>         (process-wait "Main thread" #'(lambda () ,done))
>         (values-list ,result)))))

You don't have to mess around with process wait and all that values
business.  (I'm pretty sure I wouldn't have used process-wait, so I doubt
that this macro is completely from me.  I suppose I could have been
temporarily insane.)

gui:execute-in-gui already waits until the passed-in thunk finishes in
the main thread, and takes care of providing the return values as well.

Something like (warning, typed in mail)

(defmacro in-main-thread (() &body body)
  `(gui:execute-in-gui #'(lambda () (progn , at body)))

should be all you need here.

More information about the Openmcl-devel mailing list