Is CCI Metadata thread safe?

Topics: Metadata Model, PDB Reader, PE reader
Jan 7, 2011 at 5:08 AM

Is CCI Metadata thread safe?

Can we read a metadata concurrently (in separate threads)?

Jan 7, 2011 at 5:16 AM

Yes, altough this scenario has had much less testing.

Jan 7, 2011 at 8:26 AM

I look at the implementation of NameTable and it is not thread safe.

I think this could cause problems.

Jan 7, 2011 at 8:34 AM

We plan to typing AST in different threads. I am afraid that the NameTable will cause problems.

Jan 7, 2011 at 2:19 PM

The nametable locks its dictionary before accessing it, which should be enough. The TODO comment is about a lock free solution. Is there another problem you can see? Please expand on your comments. Thanks.

Jan 8, 2011 at 12:42 AM

Sorry, I was confused by TODO. :)

Why you not use a collection like ConcurrentDictionary (from FW 4) or immutable tree-map with interlocked exchange to replace the root variable?

Locks not good idea in this case.

Jan 8, 2011 at 12:45 AM

It used to be (and perhaps still is) useful for CCI to depend only on FW 2. When a decision gets made to depend on FW 4, this would be possible.

Jan 8, 2011 at 7:34 PM

FW 2 support is important. But, you can create analog of these classes.