private static ITask DequeuePendingItem(List <ReceiverTask> receivers) { foreach (ReceiverTask current in receivers) { ITask task = Interleave.DequeuePendingItem(current, 1); if (task != null) { return(task); } } return(null); }
public ITask TryDequeuePendingTask(InterleaveReceivers receiverMask) { lock (_mutexBranches) { if ((receiverMask & InterleaveReceivers.Exclusive) > (InterleaveReceivers)0) { ITask result = Interleave.DequeuePendingItem(_mutexBranches); return(result); } if ((receiverMask & InterleaveReceivers.Concurrent) > (InterleaveReceivers)0) { ITask result = Interleave.DequeuePendingItem(_concurrentBranches); return(result); } } return(null); }
public ITask TryDequeuePendingTask(ReceiverTask receiver, int queueDepthMin) { if (receiver == null) { throw new ArgumentNullException("receiver"); } if (!(receiver.ArbiterContext is InterleaveReceiverContext)) { throw new ArgumentException("receiver", Resource1.InterleaveInvalidReceiverTaskArgumentForTryDequeuePendingItems); } if (queueDepthMin <= 0) { throw new ArgumentOutOfRangeException("queueDepthMin"); } ITask result; lock (_mutexBranches) { result = Interleave.DequeuePendingItem(receiver, queueDepthMin); } return(result); }