[pypy-dev] Any Multithreading Primitives?

Timothy Baldridge tbaldridge at gmail.com
Tue Mar 15 17:04:30 CET 2011

> Will anything written here: http://codespeak.net/pypy/dist/pypy/doc/stackless.html
> be of any use to you?  Note, this documentation isquite old and needs
> attention, and right now the stackless transform does not work with the JIT.
> changing things so that it would work doesn't seem to be that much work,
> though, we just haven't gotten around to it.

Not really. What I need are CAS operations so I can do the following:

   oldval = var
   newval = oldval + 1
   if cas(oldval, newval, var):

Basically cas takes the value you think var currently has, the value
you want var to be, and the var. Cas then updates var if and only if
var's current value == oldvar. But cas is atomic. So basically it
returns false if the cas failed, and true if it worked. Using cas you
can build mutexes, shared objects, etc.



More information about the Pypy-dev mailing list