KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The documentation for ReadOnlyCollection(of T) states that: A ReadOnlyCollection(Of T) can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure . To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. My question regards the bolded part: why is enumerating through a collection intrinsically not thread-safe what are the possible implications, and what are commonly-used workarounds?
Tags (comma-separated)
Save Edits
Cancel