Synchronize access to is_running field of GMainLoop to ensure that g_main_loop_is_running is thread safe.