client: Make g_lock_lock() wait till lock is obtained