Sharing unlocked, unchanging data between threads?
Chris Williams
aahz at seanet.com
Tue Aug 10 10:45:03 PDT 2010
I'm writing a fairly large, multithreaded application and some part
of it is causing periodic access errors.
Say that I have an associative array like:
uint[ char[] ] nameToId;
If I set all values before I start my threads going and never change
anything after that point -- all access is read only -- is there any
way that having multiple threads access it at the same time would
mess anything up? I'm doing this in several places as locking a
read-only data structure doesn't strike me as something which should
be necessary. I don't know what D's associative arrays look like
internally though, so perhaps it is dangerous to do. It would be a
major hassle to port it all over to locking everything, to test if
it fixes the problem. So, hopefully someone can say whether this is
worth checking.
More information about the Digitalmars-d-learn
mailing list