   private let filled = dispatch_semaphore_create(0)!
   private let empty =  dispatch_semaphore_create(1)!
 
-  // private var lock = OS_SPINLOCK_INIT
-
   private var closed = false
 
   deinit


  public func get() -> Int?
  {
    if closed && head >= tail { return nil }

    dispatch_semaphore_wait(filled, DISPATCH_TIME_FOREVER)
    // OSSpinLockLock(&lock)

    if head < tail
    {
      let e = element
      head++

      // OSSpinLockUnlock(&lock)
      dispatch_semaphore_signal(empty)
      return e
    }
    else
    {
      assert(closed, __FUNCTION__)
      // OSSpinLockUnlock(&lock)
      dispatch_semaphore_signal(filled)
      return nil
    }

  }

  public var isClosed: Bool { return closed }
  public var isEmpty: Bool { return tail &- head <= 0 }
  public var isFull: Bool { return tail &- head >= 1 }

  public func close()
  {
    if closed { return }

    closed = true

    dispatch_semaphore_signal(empty)
    dispatch_semaphore_signal(filled)
