You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@alex-bermishev The .net core implementation of TryTakeFromAnyCore provides an example of how to implement the fast path (i.e. non-blocking). The slow path (i.e. blocking) will be a bit more work. My initial thoughts would be to create a BlockingCollectionAggregator class. The constructor would take as input the data source collections you want to take from. Plus it would have its own internal collection. The aggregator would spin up tasks to wait on each data source collection. When data arrives from any it would get enqueued to its internal collection. The internal collection is what would feed BlockingCollectionAggregator's Take method. The Take method would include the fast path mentioned above. Additional housekeeping would be needed to manage the tasks.
Activity
gm127 commentedon Jan 29, 2019
@alex-bermishev The .net core implementation of TryTakeFromAnyCore provides an example of how to implement the fast path (i.e. non-blocking). The slow path (i.e. blocking) will be a bit more work. My initial thoughts would be to create a BlockingCollectionAggregator class. The constructor would take as input the data source collections you want to take from. Plus it would have its own internal collection. The aggregator would spin up tasks to wait on each data source collection. When data arrives from any it would get enqueued to its internal collection. The internal collection is what would feed BlockingCollectionAggregator's Take method. The Take method would include the fast path mentioned above. Additional housekeeping would be needed to manage the tasks.