implement it thread-safe

This commit is contained in:
Gregor Biswanger
2017-11-04 00:16:14 +01:00
parent 0ad6358d16
commit 7c13d19e7f
12 changed files with 108 additions and 16 deletions

View File

@@ -13,6 +13,7 @@ namespace ElectronNET.API
public sealed class Dialog
{
private static Dialog _dialog;
private static object _syncRoot = new Object();
internal Dialog() { }
@@ -22,7 +23,13 @@ namespace ElectronNET.API
{
if (_dialog == null)
{
_dialog = new Dialog();
lock (_syncRoot)
{
if(_dialog == null)
{
_dialog = new Dialog();
}
}
}
return _dialog;