G
Grandma Wilkerson
Hi,
The documentation states that enumeration through a collection is
inherently NOT thread-safe, since a thread which added/removed an item from
said collection could screw up the thread that was iterating. That makes
sense.. but... given a collection that is filled at start-time and never
modified again, is it safe to have multiple threads *reading* (not writing
to) the collection using foreach()?
I have a class that exposes an event [which is really just a collection
of delegates]. The event registrants are all hooked up at startup. Is it
safe for my class to fire the event simultaneously from two different
threads even though this would lead to the delegate collection being
iterated by two different threads?
The documentation states that enumeration through a collection is
inherently NOT thread-safe, since a thread which added/removed an item from
said collection could screw up the thread that was iterating. That makes
sense.. but... given a collection that is filled at start-time and never
modified again, is it safe to have multiple threads *reading* (not writing
to) the collection using foreach()?
I have a class that exposes an event [which is really just a collection
of delegates]. The event registrants are all hooked up at startup. Is it
safe for my class to fire the event simultaneously from two different
threads even though this would lead to the delegate collection being
iterated by two different threads?