c# - Lazy<T> .Subsequent threads to initialize if one thread fails -


i using lazy<t> lazythreadsafetymode executionandpublication , using initialization method.

what achieve if initialization fails on 1 thread ,only next thread should try , initialize again. dont want threads race initialization (as in publication mode) or exception cached , thrown again threads (as in executionandpublication mode).

is there way achieve this?

as explained here

as noted in previous section, lazy objects created specifying lazythreadsafetymode.publicationonly treat exceptions differently. publicationonly, multiple threads can compete initialize lazy instance. in case, exceptions not cached, , attempts access value property can continue until initialization successful.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -