The attached patch is currently applied by FreeBSD's ports.
I don't know too much glib or pthread internals, but seems to be safe for
Linux, I'm using it compiled with this patch right now and nothing crashed
If someone is able to see what this changes and can ask upstream what to do
with this it would be really really good.
Created attachment 65853 [details, diff]
Considering this fixed for 2.8... I hope