Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex