On Wed, Mar 14, 2012 at 2:02 PM, Robert Haas <robertmh...@gmail.com> wrote: > I think we should get rid of die_horribly(), and instead have arrange > to always clean up AH via an on_exit_nicely hook.
Good. The only exit handler I've seen so far is pgdump_cleanup_at_exit. If there's no other one, is it okay to remove all of this stacking functionality (see on_exit_nicely_index / MAX_ON_EXIT_NICELY) from dumputils.c and just define two global variables, one for the function and one for the arg that this function would operate on (or a struct of both)? We'd then have the current function and AHX (or only &AH->connection from it) in the non-parallel case and as soon as we enter the parallel dump, we can exchange it for another function operating on ParallelState*. This avoids having to deal with thread-local storage on Windows, because ParallelState* is just large enough to hold all the required data and a specific thread can easily find its own slot with its threadId. >>> Sure, but since all the function does is write to it or access it, >>> what good does that do me? >> >> It encapsulates the variable so that it can only be used for one >> specific use case. > > Seems pointless to me. Not so much to me if the alternative is to make ParallelState* a global variable, but anyway, with the concept proposed above, ParallelState* would be the arg that the parallel exit handler would operate on, so it would indeed be global but hidden behind a different name and a void* pointer. (I will address all the other points you brought up in my next patch) -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers