g_get_monotonic_time: fix race condition