ActiveAsyncPlan.cs 837 B

1234567891011121314151617181920212223242526272829
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6. namespace System.Reactive.Joins
  7. {
  8. internal abstract class ActiveAsyncPlan
  9. {
  10. private readonly Dictionary<IAsyncJoinObserver, IAsyncJoinObserver> _joinObservers = new();
  11. internal abstract Task Match();
  12. protected void AddJoinObserver(IAsyncJoinObserver joinObserver)
  13. {
  14. _joinObservers.Add(joinObserver, joinObserver);
  15. }
  16. protected void Dequeue()
  17. {
  18. foreach (var observer in _joinObservers.Values)
  19. {
  20. observer.Dequeue();
  21. }
  22. }
  23. }
  24. }