|
|
|
|
|
by monopede
5056 days ago
|
|
As I understand this, this wouldn't automatically protect you from race conditions. If you have a shared variable x then a statement like x += 5
may be fine depending on whether it is implemented as a single bytecode instruction or not. However, more complicated updates are still subject to races: x = somefunction(x)
It is only safe if you use: with thread.atomic: x = somefunction(x)
Having a serialisation doesn't mean it's the right serialisation.That said, the fundamental problem is shared mutable state, and I don't see an easy way around that in Python. In that sense, this is probably easiest to work with. |
|