Questions tagged [lazythreadsafetymode]

2 questions
14
votes
1 answer

Lazy ExecutionAndPublication - Examples That Could Cause Deadlock

The documentation for LazyThreadSafetyMode states that using the value ExecutionAndPublication could cause deadlocks if the initialization method (or the default constructor, if there is no initialization method) uses locks internally. I am trying…
dugas
  • 12,025
  • 3
  • 45
  • 51
8
votes
1 answer

Lazy with LazyThreadSafeMode.PublicationOnly and IDisposable

Today I was playing with Lazy and found an interesting case (to my mind). http://msdn.microsoft.com/en-us/library/system.threading.lazythreadsafetymode.aspx PublicationOnly: When multiple threads try to initialize a Lazy instance…
Andrey Taptunov
  • 9,367
  • 5
  • 31
  • 44