     if closed { return false }
 
     dispatch_semaphore_wait(empty, DISPATCH_TIME_FOREVER)
-    // OSSpinLockLock(&lock)
 
     if closed
     {
-      // OSSpinLockUnlock(&lock)
       dispatch_semaphore_signal(empty)
       return false
     }
 
     element = newElement
-    tail++
+    tail = tail &+ 1
 
-    // OSSpinLockUnlock(&lock)
     dispatch_semaphore_signal(filled)
 
     return true

  }

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

  public func close()
  {
    if closed { return }

    // OSSpinLockLock(&lock)
    closed = true
    // OSSpinLockUnlock(&lock)

    dispatch_semaphore_signal(empty)
    dispatch_semaphore_signal(filled)


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

    dispatch_semaphore_wait(filled, DISPATCH_TIME_FOREVER)

    if tail &- head > 0
    {
      let e = element
      head = head &+ 1

      dispatch_semaphore_signal(empty)
      return e
    }
    else
    {
      assert(closed, __FUNCTION__)
      dispatch_semaphore_signal(filled)
      return nil
    }
