       OSSpinLockUnlock(&lock)
 
       let context = UnsafePointer<T>(dispatch_get_context(ws))
-      if context == nil
-      { // not a normal code path.
-        precondition(false, __FUNCTION__)
-        return nil
+      switch context
+      {
+      case nil:
+        preconditionFailure(__FUNCTION__)
+
+      default:
+        let element = context.memory
+        dispatch_set_context(ws, nil)
+        dispatch_semaphore_signal(ws)
+        return element
       }
-      let element = context.memory
-      dispatch_set_context(ws, nil)
-      dispatch_semaphore_signal(ws)
-      return element
     }
 
     if closed

    dispatch_semaphore_wait(threadLock, DISPATCH_TIME_FOREVER)

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


      // thread was awoken by close() and put() has failed
      return false

    case &newElement:
      // the message was succesfully passed.
      return true

    default:
      preconditionFailure("Weird context value in \(__FUNCTION__)")
    }
  }

