use pthread instead of g_thread to avoid the nightmare of glib deprecating/remoring...