diff --git a/source/Windows.Devices.Gpio/GpioPin.cs b/source/Windows.Devices.Gpio/GpioPin.cs index bc558e0..8d8dca0 100644 --- a/source/Windows.Devices.Gpio/GpioPin.cs +++ b/source/Windows.Devices.Gpio/GpioPin.cs @@ -41,8 +41,15 @@ public sealed class Gpio​Pin : IGpioPin, IDisposable { _pinNumber = pinNumber; - s_eventListener = new GpioPinEventListener(); _syncLock = new object(); + + lock (_syncLock) + { + if (s_eventListener == null) + { + s_eventListener = new GpioPinEventListener(); + } + } } internal bool Init()