using RAII to control mutex resource