To make your programs thread-safe, you must first identify what
data will be shared across threads. If you are writing data that
may be read later by another thread, or reading data that may
have been written by another thread, then that data is shared,
and you must synchronize when accessing it.