   override func selectPutNow(selectionID: Selectable) -> Selection?
   {
     OSSpinLockLock(&lock)
-    if let rs = readerQueue.dequeue()
-    {
-      switch dispatch_get_context(rs)
-      {
-      case nil, cancelSelect:
-        preconditionFailure("Context is invalid in \(__FUNCTION__)")
-
-      case waitSelect:
-        // waitSelect has a significant chance of failure, but the selectPutNow() path should work "all" the time.
-        readerQueue.undequeue(rs)
-
-      default:
-        OSSpinLockUnlock(&lock)
-        return Selection(id: selectionID, semaphore: rs)
-      }
-    }
-    OSSpinLockUnlock(&lock)
+    if let rs = selectPutNow()
+    {
+      OSSpinLockUnlock(&lock)
+      return Selection(id: selectionID, semaphore: rs)
+    }
+    OSSpinLockUnlock(&lock)
+    return nil
+  }
+
+  private func selectPutNow() -> dispatch_semaphore_t?
+  {
+    precondition(lock != 0, __FUNCTION__)
+    while let ssema = readerQueue.dequeue()
+    {
+      switch ssema
+      {
+      case .semaphore(let rs):
+        return rs
+
+      case .selection(let c, let selectionID):
+        if let s = c.get()
+        {
+          OSSpinLockUnlock(&lock)
+          let mediator = SemaphorePool.dequeue()
+          let buffer = UnsafeMutablePointer<T>.alloc(1)
+          dispatch_set_context(mediator, buffer)
+
+          // two select()s talking to each other need a 3rd thread
+          dispatch_async(dispatch_get_global_queue(qos_class_self(), 0)) {
+            dispatch_semaphore_wait(mediator, DISPATCH_TIME_FOREVER)
+            // got awoken by insert()
+            precondition(dispatch_get_context(mediator) == buffer, "Unknown context in \(__FUNCTION__)")
+
+            let selection = Selection(id: selectionID, semaphore: mediator)
+            dispatch_set_context(s, UnsafeMutablePointer<Void>(Unmanaged.passRetained(selection).toOpaque()))
+            dispatch_semaphore_signal(s)
+            dispatch_semaphore_wait(mediator, DISPATCH_TIME_FOREVER)
+            // got awoken by extract()
+            buffer.destroy(1)
+            buffer.dealloc(1)
+            dispatch_set_context(mediator, nil)
+            SemaphorePool.enqueue(mediator)
+          }
+          OSSpinLockLock(&lock)
+          return mediator
+        }
+        else
+        { // try the next enqueued reader instead
+          continue
+        }
+      }
+    }
     return nil
   }
 

    // Unblock the threads waiting on our conditions.
    while let rs = readerQueue.dequeue()
    {
      dispatch_set_context(rs, nil)
      dispatch_semaphore_signal(rs)
    }
    while let ws = writerQueue.dequeue()
    {
      dispatch_set_context(ws, nil)
      dispatch_semaphore_signal(ws)
    }
    OSSpinLockUnlock(&lock)
  }


    OSSpinLockLock(&lock)

    if let ss = readerQueue.dequeue()
    { // there is already an interested reader
      OSSpinLockUnlock(&lock)
      switch ss
      {
      case .semaphore(let rs):
        switch dispatch_get_context(rs)
        {
        case nil:
          preconditionFailure(__FUNCTION__)

        case let buffer: // default
          // attach a new copy of our data to the reader's semaphore
          UnsafeMutablePointer<T>(buffer).initialize(newElement)
          dispatch_semaphore_signal(rs)
          return true
        }

      case .selection(let c, let selectionID):
        if let s = c.get()
        { // pass the data on to an insert()
          let threadLock = SemaphorePool.dequeue()
          dispatch_set_context(threadLock, &newElement)
          let selection = Selection(id: selectionID, semaphore: threadLock)
          dispatch_set_context(s, UnsafeMutablePointer<Void>(Unmanaged.passRetained(selection).toOpaque()))
          dispatch_semaphore_signal(s)
          dispatch_semaphore_wait(threadLock, DISPATCH_TIME_FOREVER)

          // got awoken
          let context = dispatch_get_context(threadLock)
          dispatch_set_context(threadLock, nil)
          SemaphorePool.enqueue(threadLock)

          switch context
          {
          case &newElement:
            return true

          default:
            preconditionFailure("Unknown context value (\(context)) in \(__FUNCTION__) on return from insert()")
          }
        }
        else
        {
          return self.put(newElement)
        }
      }
    }

