[pypy-dev] Any Multithreading Primitives?

Amaury Forgeot d'Arc amauryfa at gmail.com
Tue Mar 15 17:15:41 CET 2011


2011/3/15 Timothy Baldridge <tbaldridge at gmail.com>:
> 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.

In pypy/module/thread/ll_thread.py, allocate_lock() creates a Lock object,
similar to the Python's thread.Lock.

Careful though with threads: most of PyPy's garbage collectors are not

Amaury Forgeot d'Arc

More information about the Pypy-dev mailing list