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

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

2 Examples 7

1. Example

Project: WebQQWeChat
Source File: SimpleActorDispatcher.cs
public void PushActor(IQQActor actor)
        {
            _actorQueue.Add(actor);
        }

2. Example

Project: WebQQWeChat
Source File: MutipleActorDispatcher.cs
private void PushActor(IQQActor actor, int actorQueuesIndex)
        {
            var actorQueue = _actorQueues.GetOrAdd(actorQueuesIndex, (i) =>
            {
                var col = new BlockingCollection<IQQActor>();
                var task = Task.Run(() => Run(col), _cts.Token);
                return new Tuple<BlockingCollection<IQQActor>, Task>(col, task);
            });
            actorQueue.Item1.Add(actor);
        }