Skip to content

Make Barrel and HttpCache singletons thread-safe#80

Open
Fusion86 wants to merge 2 commits intojamesmontemagno:masterfrom
Fusion86:master
Open

Make Barrel and HttpCache singletons thread-safe#80
Fusion86 wants to merge 2 commits intojamesmontemagno:masterfrom
Fusion86:master

Conversation

@Fusion86
Copy link
Copy Markdown

@Fusion86 Fusion86 commented Feb 29, 2020

Uses technique described by Jon Skeet here https://csharpindepth.com/articles/singleton#lazy
MSDN docs: https://docs.microsoft.com/en-us/dotnet/api/system.lazy-1

I couldn't test this on Android/iOS/macOS because I don't have a Xamarin development environment. Maybe you could test this with your neat Azure pipelines? Though feel free to decline this pull request if testing it would take too much of your time, since these changes usually aren't needed (I have a pretty specific use case where I need the singleton to be thread safe).

E: The tests passed, so I guess it should work?

@jamesmontemagno jamesmontemagno self-requested a review March 2, 2020 06:27
@mos379
Copy link
Copy Markdown

mos379 commented Oct 24, 2020

wouldn't that solve #56 ?

@jamesmontemagno
Copy link
Copy Markdown
Owner

@Redth thoughts?

@jafin
Copy link
Copy Markdown

jafin commented Oct 2, 2023

Would be great to have this merged + published... Just hit issue when attempting to use the current build. Rebuilt with this PR and it worked fin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants