mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-13 12:18:08 +00:00
implement it thread-safe
This commit is contained in:
@@ -15,6 +15,7 @@ namespace ElectronNET.API
|
||||
public sealed class Notification
|
||||
{
|
||||
private static Notification _notification;
|
||||
private static object _syncRoot = new Object();
|
||||
|
||||
internal Notification() { }
|
||||
|
||||
@@ -24,7 +25,13 @@ namespace ElectronNET.API
|
||||
{
|
||||
if (_notification == null)
|
||||
{
|
||||
_notification = new Notification();
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_notification == null)
|
||||
{
|
||||
_notification = new Notification();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _notification;
|
||||
|
||||
Reference in New Issue
Block a user