Ensure coroutine context switching is safe across multiple threads.