[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Waiting for Interaction



At  2:12 PM 6/1/94 +0000, Brad Myers wrote:
>We have a complex interaction requirement that we can't figure out how to
>handle in MCL.  Normally, an interface is set up so that all event handling is
>asynchronous and dispatched from the CLOS various event handlers.  However,
>it is sometimes required to have an application wait for an interaction to
>be completed.

The following macros should help, with-event-processing-enabled
in particular. When an event handler is run, MCL's event-dispatch
code binds ccl::*processing-events* true, which disables recursive event
processing. with-event-processing-enabled below binds it to NIL to
allow recursive event processing.

-------------------------------------------------------------------------

; with-event-processing.lisp
;
; Macros to control event processing

(in-package :ccl)

(export '(without-event-processing 'with-event-processing-enabled))

(defmacro without-event-processing (&body body)
  `(let ((*processing-events* t))
     ,@body))

(defmacro with-event-processing-enabled (&body body)
  `(let ((*interrupt-level* 0))
     (without-interrupts)               ; startup kernel timer
     (let ((*processing-events* nil))
        ,@body)))