Adding a lock mechanism to protect the value list when iterating on it