[Python-Dev] Re: Atomic operations
Sun, 9 Feb 2003 22:33:33 -0800 (PST)
[Barry A. Warsaw]
> >>>>> "JH" == Jeremy Hylton <email@example.com> writes:
> JH> There was a good paper on this subject at LL2. You can find
> JH> it here: http://www.cs.williams.edu/~freund/papers.html
> Search for "Safe Asynchronous Exceptions For Python".
> Nice paper. I don't much like the nested block:/unblock: construction
> (too much indentation), but the initially: part is nice.
Since Guido seems to have his summaries, I am going to assume the
discussion ban has been lifted (if I am wrong, Guido, let me know).
So I read the paper and it is kind of what I was thinking of. I was
actually thinking more along the lines of having something like::
with atomic basically shutting down threading temporarily until everything
in its body is executed. This would basically make sure that no issues
would occur with code being changed while executing from other threads.
I would think this could be done by holding on to the GIL and not
releasing it under any conditions until the body is executed. So with no
threading occuring you can be sure that your data will not be changed in
any *extremely* unexpected way (obviously you can write bad code that can
do unexpected things, but I am going to assume you are not going to).
Now obviously this could be abused, but as the if-then-else proposal as
pointed out, almost anything can be abused.
So maybe a good idea? Totally hair-brained?