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

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


public extension Lockable {
    
    func synchronized<R>(@noescape block: () throws -> R) rethrows -> R {
        self.lock()
        defer { self.unlock() }
        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 try block()
}

// MARK: LockGroup
