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

RE: MysterX Message Loop?



At 1:49 PM -0500 7/18/01, Paul A. Steckler wrote:
>
>I believe that MrEd also separates the REPL thread from threads used
>by programs.  The difference appears to be that MrEd doesn't
>shut down when MrEd threads have any pending events left,
>using the mechanism described by Robby Findler.  So the differences
>are perhaps not so great, after all.


MrEd does provide a mechanism to implement the desired behavior, in fact.

If MysterX were to use the `yield' primitive, it could guarantee that 
there was (at least) a single event on the queue until all of the 
mysterx windows were closed. Then, it could give up that event. 
Here's how:

   ;; at startup of mysterx:
   (define mysterx-event-semaphore (make-semaphore 0))
   (yield mysterx-event-semaphore)

   ;; then, later on:
   (when last-mysterx-window-closes?
     (semaphore-post mysterx-event-semaphore))

Robby

[ sorry for the duplicate content -- the first message I sent about 
this didn't go to the list ]