         return result
     }
 
-    public func withReadLock<T>(block: () -> T) -> T {
+    public func withReadLock<T>(@noescape body: () -> T) -> T {
         // spin until we acquire read lock
         do {
             let state = _state.memory

        } while true

        // write lock acquired - run block
        let result = block()

        // unlock
        do {


    public init() {}

    private func withLock<T>(@noescape body: () -> T) -> T {
        let result: T
        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER)
        result = body()
        dispatch_semaphore_signal(semaphore)
        return result
    }

    public func withReadLock<T>(@noescape body: () -> T) -> T {
        return withLock(body)
    }

    public func withWriteLock<T>(@noescape body: () -> T) -> T {
        return withLock(body)
    }
}

