glib-compat.h: add new thread API emulation on top of pre-2.31 API