[pypy-dev] Implementing CAS

Maciej Fijalkowski fijall at gmail.com
Tue Mar 22 22:18:48 CET 2011

On Tue, Mar 22, 2011 at 3:14 PM, Benjamin Peterson <benjamin at python.org> wrote:
> 2011/3/22 Timothy Baldridge <tbaldridge at gmail.com>:
>> After my last discussion about getting some multi-threading
>> primitives, I took a look at how locks are implemented in PyPy. PyPy
>> currently uses OS level mutexes...which is okay for most uses, but in
>> my case, I need super fast spinlocks, and for that I need a CAS
>> operation. What I'm looking for is a bit of direction on how to go
>> about implementing this function (shown in C syntax):
>> int cas(*expected, *new, **location)
> I suggest you create a new low-level operation. Then the C backend can
> translate it into asm.

Which requires touching multiple places, but it's relatively easy.
Start with writing a test and then add it to

> --
> Regards,
> Benjamin
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev

More information about the Pypy-dev mailing list