replace lock with queue