     }
 }
 
+extension NSRecursiveLock {
+    func withCriticalScope<T>(@noescape block: () -> T) -> T {
+        lock()
+        let value = block()
+        unlock()
+        return value
+    }
+}
+
+


    /// Boolean indicator of the readyness of the Operation
    public override var ready: Bool {
        switch state {

        case .Initialized:
            // If the operation is cancelled, isReady should return true
            return cancelled

        case .Pending:
            // If the operation is cancelled, isReady should return true
            if cancelled {
                return true
            }

            if super.ready {
                return evaluateConditions()
            }

            // Until conditions have been evaluated, we're not ready
            return false

        case .Ready:
            return super.ready || cancelled

        default:
            return false
        }
    }


    }

    private let stateLock = NSLock()
    private let readyLock = NSRecursiveLock()

    private var _state = State.Initialized
    private var _internalErrors = [ErrorType]()
