Skip to content

Commit 9f71fc7

Browse files
manofstickJosé Rivero
authored andcommitted
Alternative System.Lazy implementation (dotnet#8963)
* Remove use of lock for PublicationOnly This involves a little bit of trickery. In avoiding the lock we need to go from m_implementation as PublicationOnly to null in a single step. We can't do this though without another object, so we reuse out Lazy object, which basically just spins its wheels until the value is ready. This shouldn't be a very common scenerio (i.e. hitting that code path) but it is possible. * Minimize additional object creation Storing factory in Lazy object, and passing Lazy as a parameter to ILazyItem functions. This means that None & PublicationOnly now need no creation of secondary object. * Remove Func<T> for default constructor invoking Fixing startup performance concerns * Moved non-generic functionality out of Lazy ...and into a helper class * Expression-bodied functions
1 parent 06745c1 commit 9f71fc7

File tree

1 file changed

+306
-240
lines changed

1 file changed

+306
-240
lines changed

0 commit comments

Comments
 (0)