S
Stéphane Ninin
Hello,
Probably a stupid question, but I am not a multithreading expert...
I want to share a dictionary between several threads.
Actually, I will wrap the dictionary in a class
and want to protect the "sensitive accesses" with locks.
The problem is I am not sure which concurrent access to the dictionary
could cause a problem.
I assume that two write's on the same location would be,
but what if one thread does
mydict['a'] = something
and another thread:
mydict['b'] = something else
Is a lock required in such a case ?
Thanks for any comments on this.
Probably a stupid question, but I am not a multithreading expert...
I want to share a dictionary between several threads.
Actually, I will wrap the dictionary in a class
and want to protect the "sensitive accesses" with locks.
The problem is I am not sure which concurrent access to the dictionary
could cause a problem.
I assume that two write's on the same location would be,
but what if one thread does
mydict['a'] = something
and another thread:
mydict['b'] = something else
Is a lock required in such a case ?
Thanks for any comments on this.