/// <summary> /// Set a method that should be executed for every item in the queue. /// </summary> /// <param name="queueItemAction">Optional action that will be called for every item taken from the queue.</param> /// <param name="actionsCanExecuteWithoutIndividualAwait"> /// True means that the many calls can be made to the /// <paramref name="queueItemAction" /> action without awaiting every single one. /// </param> /// <remarks> /// If <paramref name="actionsCanExecuteWithoutIndividualAwait" /> is true, then you guarantee that it is possible to /// run many <paramref name="queueItemAction" /> "in parallel" without interference. /// </remarks> public void SetQueueItemAction(QueueItemActionDelegate queueItemAction, bool actionsCanExecuteWithoutIndividualAwait = false) { _queueItemAction = queueItemAction; _actionsCanExecuteWithoutIndividualAwait = actionsCanExecuteWithoutIndividualAwait; }
public MemoryQueue(string name, QueueItemActionDelegate queueItemAction) : this(name) { InternalContract.RequireNotNullOrWhiteSpace(name, nameof(name)); SetQueueItemAction(queueItemAction); }
public MemoryQueue(string name, QueueItemActionDelegate queueItemAction = null, bool actionsCanExecuteWithoutIndividualAwait = false) : this(name) { InternalContract.RequireNotNullOrWhiteSpace(name, nameof(name)); SetQueueItemAction(queueItemAction, actionsCanExecuteWithoutIndividualAwait); }