Created
April 26, 2022 18:26
-
-
Save gingters/72788eab2cc09ae4a92f5b4e7c4662e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task EnsureInitializedAsync() | |
{ | |
if (_isInitialized) return; | |
if (_isInitializing && !_isInitialized) | |
{ | |
do | |
{ | |
await Task.Yield(); | |
} while (!_isInitialized); | |
return; | |
} | |
_isInitializing = true; | |
// Do initialization here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment