     OSSpinLockLock(&lock)
     if let ws = writerQueue.dequeue()
     {
-      OSSpinLockUnlock(&lock)
-
       let context = UnsafePointer<T>(dispatch_get_context(ws))
       switch context
       {
       case nil, UnsafePointer(cancelSelect):
         preconditionFailure(__FUNCTION__)
 
+      case UnsafePointer(waitSelect):
+        writerQueue.undequeue(ws)
+
       default:
+        OSSpinLockUnlock(&lock)
         let element = context.memory
-        dispatch_set_context(ws, nil)
         dispatch_semaphore_signal(ws)
-
         return Selection(selectionID: selectionID, selectionData: element)
       }
     }

    OSSpinLockLock(&lock)
    if let rs = readerQueue.dequeue()
    {
      if dispatch_get_context(rs) != waitSelect
      {
        OSSpinLockUnlock(&lock)
        return Selection(selectionID: selectionID, selectionData: rs)
      }
      readerQueue.undequeue(rs)
    }
    OSSpinLockUnlock(&lock)
    return nil

    if let rs: dispatch_semaphore_t = selection.getData()
    {
      let context = UnsafeMutablePointer<T>(dispatch_get_context(rs))
      context.initialize(newElement)
      dispatch_semaphore_signal(rs)
      return true
    }
    assert(false, "Thread left hanging in \(__FUNCTION__), semaphore not found in \(selection)")
    return false
