diff options
Diffstat (limited to 'windows/WinUI/APIHandler.cs')
-rw-r--r-- | windows/WinUI/APIHandler.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/windows/WinUI/APIHandler.cs b/windows/WinUI/APIHandler.cs index f2fb1d21..9cddd916 100644 --- a/windows/WinUI/APIHandler.cs +++ b/windows/WinUI/APIHandler.cs @@ -19,7 +19,8 @@ namespace WinUI private string url = null; - private static APIHandler instance; + private static volatile APIHandler instance; + private static object syncRoot = new Object(); public static APIHandler Instance { @@ -27,7 +28,16 @@ namespace WinUI { if (instance == null) { - + lock (syncRoot) + { + if (instance == null) + { + if (!initHandler()) + { + return null; + } + } + } } return instance; |