mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-30 04:23:38 +00:00
implement it thread-safe
This commit is contained in:
@@ -296,7 +296,13 @@ namespace ElectronNET.API
|
||||
{
|
||||
if (_app == null)
|
||||
{
|
||||
_app = new App();
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if(_app == null)
|
||||
{
|
||||
_app = new App();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _app;
|
||||
@@ -304,6 +310,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
|
||||
private static App _app;
|
||||
private static object _syncRoot = new Object();
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user