 private class Cache<T> {
     private var values = [FileCacheKey: T]()
     private let factory: (SwiftLintFile) -> T
-    private let lock = NSLock()
+    private let lock = PlatformLock()
 
     fileprivate init(_ factory: @escaping (SwiftLintFile) -> T) {
         self.factory = factory

        commandsCache.clear()
    }
}

private var assertHandlerCache = Cache({ file in assertHandlers[file.cacheKey] })

private struct RebuildQueue {
    private let lock = PlatformLock()
    private var queue = [Structure]()

    mutating func append(_ structure: Structure) {
        lock.doLocked {
            queue.append(structure)
        }
    }

    mutating func clear() {
        lock.doLocked {
            queue.removeAll(keepingCapacity: false)
        }
    }
}

