System.Collections.Concurrent.BlockingCollection.Add(IEvent)

Here are the examples of the csharp api class System.Collections.Concurrent.BlockingCollection.Add(IEvent) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: Zebus
Source File: PeerDirectoryClient.cs
private bool EnqueueIfRegistering(IEvent message)
        {
            if (_messagesReceivedDuringRegister == null)
                return false;

            if (_messagesReceivedDuringRegister.IsAddingCompleted)
                return false;

            try
            {
                _messagesReceivedDuringRegister.Add(message);
                return true;

            }
            catch (InvalidOperationException)
            {
                // if adding is complete; should only happen in a race
                return false;
            }
        }