issue:
it doesn't work to call g_main_loop_quit when the main thread is running, for example, execute a long loop.