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

RE: MysterX Message Loop?



> When I run mxdemo.ss from the MysterX collects dir (using "MrEd -r
> mxdemo.ss") the demo window opens and then automatically closes; there
> doesn't seem to be a message loop. If I create a MrEd window within that
> script--even if it isn't visible--the MysterX window stays open and works
> correctly. (The scripts in the test dir keep their windows open because
> they write to the pseudo-console; if they don't, their windows also close.)
> 
> First question: is there a different way to get a message loop going?
> Second question: why doesn't a MysterX browser window create its own
> message loop?

The demo program contains a sequence of expressions.  When all of those 
expressions have been evaluated, MrEd closes.  I've always run the 
demo by using "load" in MzScheme or evaluating it in DrScheme.  Running it
that way, you get a REPL prompt while the demo is running.  

A browser window does have a message loop, but it runs in a 
different thread than the main Scheme thread.  This loop, although
it's in Scheme, really has the purpose of servicing Windows messages.
You could add a do-nothing loop at the end of the demo code to get it
to behave like you want:

	(let loop ()
	   (sleep 1)
         (loop))

-- Paul