On Tue, Mar 22, 2011 at 3:14 PM, Benjamin Peterson <[email protected]> wrote: > 2011/3/22 Timothy Baldridge <[email protected]>: >> 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 pypy/rpython/lltypesystem/lloperation.py > > -- > Regards, > Benjamin > _______________________________________________ > [email protected] > http://codespeak.net/mailman/listinfo/pypy-dev > _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
