Given a specific code snippet representing a multi-threaded process, identify potential race conditions and explain how to resolve them.