 
 public extension Lockable {
     
-    func synchronized<R>(@noescape block: () -> R) -> R {
+    func synchronized<R>(@noescape block: () throws -> R) rethrows -> R {
         self.lock()
         defer { self.unlock() }
-        return block()
-    }
-}
-
-public func synchronized<R>(obj: AnyObject, @noescape block: () -> R) -> R {
+        return try block()
+    }
+}
+
+public func synchronized<R>(obj: AnyObject, @noescape block: () throws -> R) rethrows -> R {
     objc_sync_enter(obj)
     defer { objc_sync_exit(obj) }
-    return block()
+    return try block()
 }
 
 // MARK: LockGroup

        return OSSpinLockTry(&_lck)
    }
    
    public mutating func synchronized<R>(@noescape block: () -> R) -> R {
        self.lock()
        defer { self.unlock() }
        return block()
    }
}


        }
        return true
    }
    public func synchronized<R>(@autoclosure predicate: () -> Bool, @noescape block: () throws -> R) rethrows -> R {
        self.lock(predicate)
        defer { self.unlock() }
        return try block()
    }
    public func synchronized<R>(@autoclosure predicate: () -> Bool, time: Double, @noescape block: () throws -> R) rethrows -> R? {
        return try synchronized(predicate, date: NSDate(timeIntervalSinceNow: time), block: block)
    }
    public func synchronized<R>(@autoclosure predicate: () -> Bool, date: NSDate, @noescape block: () throws -> R) rethrows -> R? {
        if self.lock(predicate, date: date) {
            defer { self.unlock() }
            return try block()
        }
        return nil
    }
