     }
 
     private func _register(_ closure: @escaping () -> Void) -> Bool {
-        _lock.lock(); defer { _lock.unlock() }
-        _observers?.append(closure)
-        return _observers != nil
+        lock.lock()
+        defer { lock.unlock() }
+
+        observers?.append(closure)
+        return observers != nil
     }
 
     /// Communicates a request for cancellation to the managed tokens.

        }
    }

    private func _cancel() -> ContiguousArray<() -> Void>? {
        _lock.lock(); defer { _lock.unlock() }
        let observers = _observers
        _observers = nil // transition to `isCancelling` state
        return observers
    }
}

// We use the same lock across different tokens because the design of CTS
// prevents potential issues. For example, closures registered with a token
// are never executed inside a lock.
private let _lock = NSLock()

/// Enables cooperative cancellation of operations.
///

        return CancellationToken(source: self)
    }

    private var lock = NSLock()
    private var observers: [() -> Void]? = []

    /// Initializes the `CancellationTokenSource` instance.
    init() {}
