Generic async worker loop.