                 var buf: Int8 = 0
               #if os(Windows)
                 var n: DWORD = 0
-                ReadFile(signalWatchingPipe[1], &buf, 1, &n, nil)
+                ReadFile(Self.signalWatchingPipe[1], &buf, 1, &n, nil)
               #else
-                let n = read(signalWatchingPipe[0], &buf, 1)
+                let n = read(Self.signalWatchingPipe[0], &buf, 1)
               #endif
                 // Pipe closed, nothing to do.
                 if n == 0 { break }
                 // Read the value of wasInterrupted and set it to false.
-                let wasInt = wasInterruptedLock.withLock { () -> Bool in
-                    let oldValue = wasInterrupted
-                    wasInterrupted = false
+                let wasInt = Self.wasInterruptedLock.withLock { () -> Bool in
+                    let oldValue = Self.wasInterrupted
+                    Self.wasInterrupted = false
                     return oldValue
                 }
                 // Terminate all processes if was interrupted.

                }
            }
          #if os(Windows)
            CloseHandle(signalWatchingPipe[0])
          #else
            close(signalWatchingPipe[0])
          #endif
        }
        thread.start()


    /// Start watching for interrupt signal and call the handler whenever the signal is received.
    public init(_ handler: @escaping () -> Void) throws {
        // Swift reserves the right to lazily-initialize globals & statics
        // force initialize the statics so they as signal-safe
        _ = Self.wasInterrupted
        _ = Self.wasInterruptedLock
        _ = Self.signalWatchingPipe
        _ = Self.oldAction

        // Create a signal handler.
        self.signalHandler = { _ in
            // Turn on the interrupt bool.
            InterruptHandler.wasInterruptedLock.withLock {
                InterruptHandler.wasInterrupted = true
            }
            // Write on pipe to notify the watching thread.
            var byte: UInt8 = 0
          #if os(Windows)
            var bytesWritten: DWORD = 0
            WriteFile(InterruptHandler.signalWatchingPipe[1], &byte, 1, &bytesWritten, nil)
            return true
          #else
            write(InterruptHandler.signalWatchingPipe[1], &byte, 1)
          #endif
        }
      #if os(Windows)
