[PATCH 1 of 9] atexit: add special-purpose atexit functionality to util

Yuya Nishihara yuya at tcha.org
Tue Apr 11 09:43:40 EDT 2017


On Mon, 10 Apr 2017 13:15:56 -0700, Bryan O'Sullivan wrote:
> On Mon, Apr 10, 2017 at 12:49 PM, Jun Wu <quark at fb.com> wrote:
> 
> > I wonder if it's better if the global state is moved to a
> > "dispatch.request"
> > or "ui" object. That may give threaded request handlers more confidence.
> 
> The new atexit code is only run during process exit. I was careful to
> ensure that I wasn't accidentally running it at the end of e.g. every web
> or chg request, but if they somehow arose, such cases would result in a
> process crash and test failure.

dispatch.dispatch() can be called more than once in a plain commandserver,
so util.atexit() is actually atexit_of_request. It is nice feature for some
exit handlers (e.g. print_time), though.


More information about the Mercurial-devel mailing list