Print

Print


there are several component to the stories.

you could add such a handler first thing in main

Technically, no. In the general case, we do not have control of the main. In v6, we were able to re-organize enough that we have a good approximation of 'early in main', and we register an atexit there.

However this is still not the right time. If the order is:

  1. main starts
  2. register atexit
  3. dlopen library

the tear down order will be

  1. end of main
  2. dlclose (indirectly by system) library
  3. execute at exit.

Note that in v6 we also have three distinct operation in the tear down

a. TROOT::EndOfProcessCleanups
b. CleanUpROOTAtExit
c. TROOT destructor

and those do:

a. calls Close on all the TFile.
b. actually deletes the objects.
c. last resort closing and deletion

It is not clear whether (a) could safely delete the TFile object as some of them can be held by the user in static globals in their own libraries.

Historically changes to the tear down order have been very fragile (i.e. almost always have unintended consequences). I am quite leery to change v5.34 (i.e. will likely have to spend significant time to implement and then even more to debug) when there is two 'straight forward'-ish work-around: either upgrade to v6 or make sure to explicitly delete the TFile before the end of the process.

But then why?

Why what? :) ...


Reply to this email directly or view it on GitHub.



Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1