Skip to content

Comment on In the C++ bag of tricks: scoped locks

Comments

What about:

     #define LOCKED(lk) for(int i=lk_lock(lk); i == 0; lk_unlock(lk), i++)
Probably better to test for 0 exactly, in case it fails. You don't want it to unlock twice just because it returns -1.

This is so wrong on so many levels.

It's not any worse than what was suggested in the linked article...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.