3 ms·
If it's like CPython, the interpreter will release the GIL on IO or after a number of "ticks", but "ticks" are very loosely mapped to an expression or statement
by masklinn 14y ago
If it's like CPython, the interpreter will release the GIL on IO or after a number of "ticks", but "ticks" are very loosely mapped to an expression or statement. So it will generally put all of (get value at index, increment value, store value) under a single lock.
So I'd expect that even on MRI the original code could in fact fail to yield 0 once in a while. That's what'd happen on CPython