Update RAII and mutex