Comment on In the C++ bag of tricks: scoped locksComments−infogulch12yWhat 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.−eps12yThis is so wrong on so many levels.−infogulch12yIt's not any worse than what was suggested in the linked article...
Comments
What about:
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...