Your question is not quite valid. It all depends on what you mean. Thread safety is the concept applied to any number of threads, no matter if they are in the same process or different processes. But it all depends on the reason of unsafe execution. You simply need to understand these reasons and decide accordingly. Some operations can be unsafe for different thread, no matter what they are, but the objects creating unsafe situation might never be shared by two threads if they are in different processes, because the processes are isolated. Are you getting the idea?
First of all, read the MSDN help page thoroughly. It says that the stream is not thread safe, not the function. I don't think we have enough room in a single
Quick Answer for detailed discussion of all aspects of thread safety, but let's consider why the memory stream can be not thread safe. This is because it provides the access to the same area of memory to the user of the interface pointer. You can copy the same pointer to another thread in the process, so two threads can access the same memory. Do you have to explain why this is unsafe?
In this particular case, the problem won't appear if you have only one thread working with this memory, and it would not appear if you run another instance of the same application. You need to understand what the processes are. They are isolated, so all memory addresses and handles to system objects have the values only meaningful to the current process. Even if two pointers in two different processes have the same numeric values, in different processes they still point to different physical memory. This is because, first of all, the memory accessed by a process is virtual, which is the hardware-supported memory management technique. And of course two different instances of your applications are two separate isolated processes. So, you should not have to worry.
At the same time, it does not mean that you never face problems with such memory stream related to the lack of thread safety, even if you use memory in different processes. Theoretically speaking, you can run into the problem if you create two stream on the same
shared memory object: sharing memory between two processes is possible via IPC:
https://en.wikipedia.org/wiki/Inter-process_communication[
^],
https://en.wikipedia.org/wiki/Shared_memory_(interprocess_communication)[
^].
I hope this is not your case, but you need to understand the background.
[EDIT]
Also, remember one simple principle of thread synchronization: "not synchronization is best synchronization". There are many ways to avoid conflicts between threads instead of synchronizing them. For example, if you do all calculation on stack, using only the stack memory and memory passed in the function arguments, without sharing, you never create conflicts between threads.
It may require deep understanding on how objects are stored and bound, how thread works, things like that.
—SA