Port to glib 2.31.x g_thread API
g_thread_init() is deprecated since glib 2.24, call g_type_init() instead.
Bump glib requirement accordingly.
g_thread_create is deprecated since 2.31, use g_thread_new() instead. When
building with a glib earlier than 2.31, provide a backwards compatibility shim.
[Added a comment about why we're using g_type_init() in a test that
doesn't otherwise use GObject -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44413
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>