public virtual void Enqueue(TEntity item) { if (InternalBuffer == null || InternalBuffer.Count >= Settings.WorkerBatchSize) { _itemAvailableEvent.Reset(); _itemAvailableEvent.WaitOne(); } InternalBuffer.TryAdd(item); }
protected virtual async Task <T> Enqueue(T item) { LoadItem(item); if (InternalBuffer.Count >= BufferSize) { _semaphore.WaitOne(); } InternalBuffer.TryAdd(item); return(item); }