4 ms·
Solvable by creating a Preprocessor macro which creates a unique and complex-named identifier. #define LOCKED(lk) for(int UNIQUE_ID=0; UNIQUE_ID<1 && !lk_loc
by cjensen 13y ago
Solvable by creating a Preprocessor macro which creates a unique and complex-named identifier.
#define LOCKED(lk) for(int UNIQUE_ID=0; UNIQUE_ID<1 && !lk_lock(lk); lk_unlock(lk), UNIQUE_ID++)
Use __LINE__ to help make the id unique.
- VikingCoder 13y agoThen 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.