     element = newElement
     elementCount++
 
+    OSSpinLockUnlock(&mutex)
     dispatch_semaphore_signal(filled)
 
     return true

    if closed { return false }

    dispatch_semaphore_wait(empty, DISPATCH_TIME_FOREVER)

    if closed
    {
      dispatch_semaphore_signal(empty)
      return false
    }

    let e = element
    elementCount--

    OSSpinLockUnlock(&mutex)
    dispatch_semaphore_signal(empty)

    return e
