Re:In the C++ bag of tricks: scoped locks
by cjensen on Friday February 07, 2014 @03:15PM
(#7198442)
Solvable by creating a Preprocessor macro which creates a unique and complex-named identifier.
Use __LINE__ to help make the id unique.
[ Parent
| on HN ]
Re:In the C++ bag of tricks: scoped locks
by VikingCoder on Friday February 07, 2014 @04:24PM
(#7198839)
Then you still can't forget and do this:
lock(lk_var) lock(lk_var2)
{
lk_var = lk_var2;
}
Or this: lock(lk_var) { lock(lk_var2 { lk_var = lk_var2; } }
Using the pre-processor to solve a regular, every day, hum-drum, solved-a-billion-times RAII problem is bad news.