Optimization of mutex