Replace the platform-specific synchronization logic in WorkerThread with simplified platform-independent logic that is less complex and hopefully less fragile.