         preconditionFailure(__FUNCTION__)
 
       case waitSelect:
+        // waitSelect has a significant chance of failure, but the selectGetNow() path should work "all" the time.
         writerQueue.undequeue(ws)
 
       default:

            let selectptr = UnsafeMutablePointer<Void>(Unmanaged.passRetained(selection).toOpaque())
            dispatch_set_context(s, selectptr)
            dispatch_semaphore_signal(s)
            return
          }
        }
        else
        {
          self.writerQueue.undequeue(ws)
          // The spinlock stayed locked between dequeue() and undequeue(),
          // so it was transparent to other threads.
          OSSpinLockUnlock(&self.lock)
          return
        }
      }

      if self.closed

      OSSpinLockLock(&self.lock)
      if let ws = self.writerQueue.dequeue()
      {
        let context = dispatch_get_context(ws)
        switch context
        {
        case nil:
          preconditionFailure(__FUNCTION__)

        case waitSelect:
          if let s = semaphore.get()
          {
            OSSpinLockUnlock(&self.lock)

            let buffer = UnsafeMutablePointer<T>.alloc(1)
            dispatch_set_context(threadLock, buffer)
            let contextptr = UnsafeMutablePointer<Void>(Unmanaged.passRetained(threadLock).toOpaque())
            dispatch_set_context(ws, contextptr)
            dispatch_semaphore_signal(ws)
            dispatch_semaphore_wait(threadLock, DISPATCH_TIME_FOREVER)

            let context = dispatch_get_context(threadLock)
            switch context
            {
            case buffer:
              let element = buffer.move()
              buffer.dealloc(1)
              let selection = Selection(selectionID: selectionID, selectionData: element)
              let selectptr = UnsafeMutablePointer<Void>(Unmanaged.passRetained(selection).toOpaque())
              dispatch_set_context(s, selectptr)
              dispatch_semaphore_signal(s)

            case nil:
              buffer.dealloc(1)
              dispatch_set_context(s, nil)
              dispatch_semaphore_signal(s)

            default:
              buffer.dealloc(1)
              preconditionFailure("Weird context value (\(context)) in waitSelect case of \(__FUNCTION__)")
            }
          }
          else
          {
            self.writerQueue.undequeue(ws)
            // The spinlock stayed locked between dequeue() and undequeue(),
            // so it was transparent to other threads.
            OSSpinLockUnlock(&self.lock)
          }

        default:
          if let s = semaphore.get()
          {
            OSSpinLockUnlock(&self.lock)

            let element: T = UnsafePointer(context).memory
            dispatch_semaphore_signal(ws)

