An attempted simpler fix for #6003 (closed), as mentioned in !7700: Move dispatch_pool from a global variable to a function-local static, which brings its destruction earlier to before dll unloading.
The approach has since been changed, since that didn't work - instead, make the statics.h system allow thread-safe initialisation, just like the usual function-local static initialisation idiom does. This allows a similar approach to the original version of !7700, which is to have dispatch_pool's lifetime be controlled by statics.h.
This needs testing on OSWindows. The steps to reproduce the hang on exit are:
- Open Inkscape
- Draw something with a filter (e.g. a rectangle with a blur)
- Exit (and observe Inkscape process still running in task manager)
The first commit is a C++20 refactoring in the same area of the code (use std::stop_token in dispatch_pool), suggested by a todo comment by @liamwhite - could do with some sanity-check reviewing there.

























