WIP: Enable static builds on Windows using TLS callbacks
This is a follow-up from !1316 (closed)
This MR addresses the remaining points in !1316 (closed). For per-thread cleanup (needed for GPrivate) it uses TLS callbacks, as suggested in !1316 (comment 730444).
TLS callbacks are a feature of the OS/loader/PE format to get notifications about thread start and termination (and are executed in the context of the starting/terminating thread, of course). That way we can cleanup GPrivate data for every thread, even if it was not created by GLib.
Edited by Luca Bacci