factor out non-portable waits