This project is read-only.

PeReader.DefaultHost threadsafe?

Aug 25, 2011 at 7:43 AM

Is PeReader.DefaultHost threadsafe?

Best regards,

D.R.

Aug 25, 2011 at 7:58 AM

Does not solve my problem anyways.

I want to analyze more than one assembly using more than one PeReader, but: You use such a huge amount of global locks within CCI (why?) that there is not really a performance gain.

How to do it the right way?

I already tried to share the metadata host for all my assembly analyzers but that didn't work out as well : /

 

Best regards,

D.R.

Aug 25, 2011 at 3:33 PM

PeReader.DefaultHost is supposed to be thread safe, but it has not been tested or analyzed to ensure this. If you have any details on a problem you saw, that might be helpful.

The global locks are there to avoid running into dead locks, which otherwise occur all too often. Some of them may be avoidable, but I have not had the time to do a really thorough review of the locks in the Pe Reader. Nevertheless, it does seem somewhat counter intuitive for you to see no speed up, particularly if your analysis is non trivial. Experience with an earlier version of CCI (which is used with the static anlaysis engine, FxCop, that is included in VS) showed that global locks were compatible with speed up on 32-way machines at least for that scenario. Perhaps you should investigate some more and try to find the source of the contention. Perhaps something can be done about it.