We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a risk that initialized is cached between threads, leading to multiple initializations.
initialized
Explaination;
get
firstTime
delegate
Fix; Make initialized and delegate volatile to ensure visibility across threads.
volatile
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There is a risk that
initialized
is cached between threads, leading to multiple initializations.Explaination;
get
and enters thefirstTime
method.firstTime
completes, Thread 2 callsget
.initialized
might not be updated yet (due to thread interleaving), Thread 2 might also enter thefirstTime
method.delegate
andinitialized
, leading to multiple initializations.Fix;
Make
initialized
anddelegate
volatile
to ensure visibility across threads.The text was updated successfully, but these errors were encountered: