Why get read also locked in the Vector, the feeling is just add lock
CodePudding user response:
Don't lock will cause dirty reads, such as read:
Arr. Get (arr. The size () - 1)
At this time another thread just expanded, haven't fill data, read the above code is empty,
Or another thread in the delete data, the above code might throw exceptions,
CodePudding user response: