Hi Zaldy,
zaldy <zaldy@neutrino.kek.jp> wrote concerning
[ROOT] How do we exit from an application ....? [Wed, 27 Aug 2003 01:33:57 +0900 (JST)]
----------------------------------------------------------------------
>
> Dear ROOters,
>
> How do we exit from an application?
> Is the method
>
>
> int main()
> {
> theApp->Run();
> theApp->Terminate()
> ....
> return 0;
> }
> enough?
Once you've executed `TApplication::Run' you're sitting inside an
event loop, and the only reasonable way to get out of that, is to
somehow create a `TApplication::Terminate' event (it shouldn't come
after the `TApplication::Run', but from somewhere else). One way to
do that, is to have a GUI that sends a termination signal to your
application, another is to do it from the CINT Command Line Interface,
using the `.q' (and related) commands, or you can send it once some
condition is true.
If you just want your program to run, do it's thing, and then exit,
you should not call `TApplication::Run'.
> I tried this but it seems that I always have to the "Ctlr + C" in
> order to end the application.
Hitting `C-c' could have the unfortunate side-effect that you by-pass
your carefully written cleanup code, like flushing `TTree's to disk,
closing a network connection, and so on.
Yours,
___ | Christian Holm Christensen
|_| | -------------------------------------------------------------
| | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91
_| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91
_| Denmark Office: (+45) 353 25 305
____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
| |
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET