setup: replace the g_usleep hack with a mutex