[GLib] Added black magic threading functions.