[pypy-dev] Any Multithreading Primitives?

Dima Tisnek dimaqq at gmail.com
Thu Mar 17 04:51:59 CET 2011

how about dict.setdefault or dict.popitem as a quick hack?

unless you are trying to get rid of gil, in which case, sorry I missed
your point

On 15 March 2011 09:04, Timothy Baldridge <tbaldridge at gmail.com> wrote:
>> 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:
> while(True):
>   oldval = var
>   newval = oldval + 1
>   if cas(oldval, newval, var):
>       break
> 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.
> http://en.wikipedia.org/wiki/Compare-and-swap
> Timothy
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev

More information about the Pypy-dev mailing list