3 ms·
If only one thread is reading or writing the counter at a time, and holds the GIL while doing so, it's not a data race, but a mutex which fails to ensure the at
by nyanpasu64 5y ago
If only one thread is reading or writing the counter at a time, and holds the GIL while doing so, it's not a data race, but a mutex which fails to ensure the atomicity of the read-modify-write operation:
with GIL:
x = counter + 1
with GIL:
counter = x