 
     private var _state: UnsafeMutablePointer<Int32>
 
+    /// Allocate the spinlock.
     public init() {
         _state = UnsafeMutablePointer.alloc(1)
         _state.memory = 0

    }
}

public final class PThreadReadWriteLock: ReadWriteLock {
    private var lock: UnsafeMutablePointer<pthread_rwlock_t>

    public init() {
        lock = UnsafeMutablePointer.alloc(1)
        let status = pthread_rwlock_init(lock, nil)

        return result
    }

    /**
    Call `body()` with a writing lock.

    The given function is guaranteed to be called exclusively.

    :param: body A function that writes a value while locked, then returns some
    value.

    :returns: The value returned from the given function.
    */
    public func withWriteLock<T>(@noescape body: () -> T) -> T {
        let result: T
        pthread_rwlock_wrlock(lock)
