Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: MEF thread safety

$
0
0
The export providers like:
  • CompositionContainer
  • ComposablePartExportProvider
  • CatalogExportProvider
have dedicated constructors that accept parameter (bool isThreadSafe) indicating that it should be "true if export provider must be thread-safe; otherwise, false.".

We know that even if we specify "true" - above classes won't be thread-safe for operations that causes recomposition (e.g. executing composition or exports change in the uderlying catalog).

Does it still means that if we provide synchronization for operations causing recompositon - other operations will be guaranteed to be thread safe? (assuming isThreadSafe=true)

Other words:
  • we set isThreadSafe=true
  • we put lock on operations causing recomposition (so that Compose(...), Catalogs.Add(...) are synchronized)
  • we do not synchronize GetExports operations or access to the exported objects via Lazy<> imports
Does it is still thread-safe?

Viewing all articles
Browse latest Browse all 265

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>