[mercury-users] Way to exit immediately from a Mercury program?

Jonathan Morgan jonmmorgan at gmail.com
Fri Apr 28 14:51:20 AEST 2006


On 4/27/06, Jonathan Morgan <jonmmorgan at gmail.com> wrote:
> On 4/27/06, Julien Fischer <juliensf at cs.mu.oz.au> wrote:
> >On Thu, 27 Apr 2006, Jonathan Morgan wrote:
> > > I'm interested because Gtk+ also has a main loop that is never
> > > returned from.  As I currently have it (which is the same as the C
> > > Gtk+ way of handling it) the Gtk quit must be called from the (main
> > > window) destroy event, otherwise the application will never terminate.
> > >  I have not done any calling of Mercury termination functions, and
> > > it's not entirely clear to me where such calls should go, and whether
> > > the exit status works nicely with Gtk's cleanup functions.
> >
> > IIRC, gtk has functions that allow you to run one (or a fixed number of)
> > iteration(s) of the main loop.  It might be possible to bypass gtk's main
> > loop and implement your own at the Mercury level.
>
> I'll have a look, but for the moment gtk_main and gtk_main_quit look
> distinctly easier (and thus more appealing).

It seems that I misinterpreted it.  Gtk main loops can be called
recursively (used for modal dialogs, among other things), and all
gtk_main_quit does is force the deepest gtk_main to return, so then
Mercury would regain control, and be able to clean up afterwards.

Jon

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list