code: func (q *Queue) Poll(number int64, timeout time.Duration) ([]interface{}, error) {
  	if number < 1 {
  		// thanks again go
  		return []interface{}{}, nil
  	}
  
  	q.lock.Lock()
  
  	if q.disposed {
  		q.lock.Unlock()
  		return nil, ErrDisposed
  	}
  
  	var items []interface{}
  
  	if len(q.items) == 0 {
  		sema := newSema()
  		q.waiters.put(sema)
  		q.lock.Unlock()
  
  		var timeoutC <-chan time.Time
  		if timeout > 0 {
  			timeoutC = time.After(timeout)
  		}
  		select {
  		case <-sema.ready:
  			// we are now inside the put's lock
  			if q.disposed {
  				return nil, ErrDisposed
  			}
  			items = q.items.get(number)
  			sema.response.Done()
  			return items, nil
  		case <-timeoutC:
  			// cleanup the sema that was added to waiters
  			select {
  			case sema.ready <- true:
  				// we called this before Put() could
  				// Remove sema from waiters.
  				q.lock.Lock()
  				q.waiters.remove(sema)
  				q.lock.Unlock()
  			default:
  				// Put() got it already, we need to call Done() so Put() can move on
  				sema.response.Done()
  			}
  			return nil, ErrTimeout
  		}
  	}
  
  	items = q.items.get(number)
  	q.lock.Unlock()
  	return items, nil
  }
docs: // Poll retrieves items from the queue.  If there are some items in the queue,
  // Poll will return a number UP TO the number passed in as a parameter.  If no
  // items are in the queue, this method will pause until items are added to the
  // queue or the provided timeout is reached.  A non-positive timeout will block
  // until items are added.  If a timeout occurs, ErrTimeout is returned.