What's an "atomic" operation (in a threaded context)?

Dieter Maurer dieter at handshake.de
Fri Nov 14 15:08:49 EST 2003


Peter Hansen <peter at engcorp.com> writes on Wed, 12 Nov 2003 17:49:10 -0500:
> ...
> >               9 STORE_SUBSCR
> ...
> In a nutshell, your "single bytecode operation" theory is correct,
> and each of the above lines represents a single bytecode.  Therefore
> the only line which matters is STORE_SUBSCR (the actual assignment)
> and it is atomic

Are you sure? "STORE_SUBSCR" may dereference an object causing
the object to be deleted. Its destructor may execute arbitrary
code.

Almost surely (I trust the Python developpers), this happens
after the assignment has been made (but before "STORE_SUBSCR" finished).
Maybe, this is enough "atomicity" for you.


Dieter




More information about the Python-list mailing list