Is IStorage file collector thread safe?

I am using ISODage Compound File Implementation from C # (StgCreateDocfile).

Is it safe to access one instance of IStorage / IStream from multiple threads if I synchronize reading and writing myself? Or are there problems with COM that might be problematic here?

For example, is it safe to call EnumElements to get all the threads in the repository, and at the same time (and from another thread) create and write a new thread?

I already wrote a stress test for my implementation, and it had no problems, but I need to be 100% sure. I did not find this information in MSDN docs.

+4
source share
1 answer

Tuff one. There is a fragment about this in the documentation for the ILockBytes interface. It says standard IStorage and IStream implementations implement IMarshal. This will make them thread safe if you follow the rules for COM streaming. This is easy to forget when interface pointers are in-proc. You should use something like CoMarshalInterThreadInterfaceInStream () or IGlobalInterfaceTable. You will go crazy without blocking yourself.

+1
source

All Articles