On Sat, Feb 11, 2012 at 10:14 PM, Juan Jose Garcia-Ripoll <juanjose.garciaripoll@googlemail.com> wrote:
I believe this would still work in the Windows implementation, where locks are always recursive, but it strongly relies on having libatomics compiled in for CAS support.

Sorry, I mixed up the code of the two functions a bit. I notice that there is still a problem when the code gets interrupted before the owner is set and the user does not unwind. This would happen, for instance, when the thread is suspended by the garbage collector.

I have been toying for the last hour with alternatives, but while there are some that profit from POSIX's error detection by forcing all locks to be non-recursive, those do not work at all in Windows.

Definitely this all is rather messy :) I wonder whether it would make sense to use CAS + wait times as SBCL does.


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)