Suppose I need to convert an STA COM object into an MTA object. Single threaded apartments guarantee not just that only one thread will call the object at a time, but that it's always the same thread (thread affinity).
I think I understand the first requirement: the object and its shared data needs to be read and written in a thread safe manner.
I am less clear on what I need to ensure that my object does not require thread affinity. I am aware of two concerns:
- Thread local storage
- Locks
Are there any other common (or uncommon) issues that would cause an object to fail without an outside guarantee of thread affinity?