[pypy-dev] Easy way to get access to cmpxchg?

Armin Rigo arigo at tunes.org
Sat Feb 22 08:13:48 CET 2014


Hi Timothy,

On 22 February 2014 01:39, Timothy Baldridge <tbaldridge at gmail.com> wrote:
> compare_and_swap(foo.bar, oldval, newval)

At some point we added a way to do it (basically you can do it
yourself, by writing a one-line function in C and calling it).  We no
longer do that: it's too much of a mess if you start having
non-GIL-protected code written in RPython.  Either you are extremely,
extremely careful, or random things will explode.  What we do instead,
e.g. in the stm branches, is to write more C code.  For the complete
parts that really need to run without any GIL protection, C is better
than RPython after all.


A bientôt,

Armin.


More information about the pypy-dev mailing list