On Apr 6, 2014, at 11:04 AM, Daniel Horn wrote:
Thanks for thinking this through. An alternative is using a trylock and assuming a cache miss (or not adding to the cache) if trylock fails.
I don't think that's safe with respect to the issue of being suspended and causing deadlock. The try may succeed, in which case you hold the critical section, in which case you should have set the sigmask beforehand, in which case you still incur the syscall expense.
(Although I'm still not confident I've completely understood the purpose of blocking signals for the duration of holding that critical section.)
-Ken