lock protect is needed while modifying the queue