@@ -16,63 +16,61 @@ protected internal void ReleaseListAwaiter ()
1616
1717 internal void Submit ( Task < T > work )
1818 {
19- lock ( this . _listAccessLock )
19+ lock ( this . _listAccessLock )
2020 this . tasks . AddLast ( work ) ;
2121
2222 // if the list was empty just an item ago, signal it's not anymore.
2323 // this limit avoids useless cross thread calls that would slow everything down.
24- if ( this . tasks . Count == 1 )
24+ if ( this . tasks . Count == 1 )
2525 this . ReleaseListAwaiter ( ) ;
2626 }
2727
2828
2929 public bool AnyTaskLeft ( )
3030 {
31- lock ( this . _listAccessLock )
31+ lock ( this . _listAccessLock )
3232 return this . tasks . Any ( ) ;
3333 }
3434
3535 public bool AnyTaskCompleted ( )
3636 {
37- lock ( this . _listAccessLock )
37+ lock ( this . _listAccessLock )
3838 return this . tasks . Any ( t => t . IsCompleted ) ;
3939 }
4040
4141 public async IAsyncEnumerable < T > Elaborated ( )
4242 {
4343 this . EnsureExclusiveExecution ( true ) ;
4444
45- while ( ! this . cancelPendingTasksSource . IsCancellationRequested )
45+ while ( ! this . cancelPendingTasksSource . IsCancellationRequested )
4646 {
4747 // avoid deadlocks
48- if ( this . AnyTaskLeft ( ) )
48+ if ( this . AnyTaskLeft ( ) )
4949 {
5050 var completed = await Task . WhenAny ( this . tasks ) . ConfigureAwait ( false ) ;
5151
52-
53-
54- lock ( this . _listAccessLock )
52+ lock ( this . _listAccessLock )
5553 this . tasks . Remove ( completed ) ;
5654
5755 yield return completed . Result ;
5856 continue ;
5957 }
6058 else
6159 {
62- if ( await this . OnNoTasksLeft ( ) . ConfigureAwait ( true ) )
60+ if ( await this . OnNoTasksLeft ( ) . ConfigureAwait ( true ) )
6361 break ;
6462 }
6563 }
6664
67- lock ( this . _listAccessLock )
65+ lock ( this . _listAccessLock )
6866 this . _exclusiveExecution = false ;
6967
7068 }
7169
7270 public async Task Elaborate ( )
7371 {
74- await foreach ( var res in this . Elaborated ( ) )
75- this . OnElaborated ? . Invoke ( res ) ;
72+ await foreach ( var res in this . Elaborated ( ) )
73+ this . OnElaborated ? . Invoke ( this , new AsyncElaboratedEventArgs < T > ( res ) ) ;
7674 }
7775
7876
@@ -85,7 +83,7 @@ Task listAwaiter ()
8583 return this . _emptyListAwaiter . WaitAsync ( ) ;
8684 }
8785
88- switch ( this . Settings . _asyncWaitingMethod )
86+ switch ( this . Settings . Runtime . _asyncWaitingMethod )
8987 {
9088
9189 case AsyncWaitingMethod . Exit :
@@ -103,7 +101,7 @@ Task listAwaiter ()
103101
104102 case AsyncWaitingMethod . Timeout :
105103 var list = listAwaiter ( ) ;
106- var timeout = Task . Delay ( this . Settings . _asyncWaitTime ) ;
104+ var timeout = Task . Delay ( this . Settings . Runtime . _asyncWaitTime ) ;
107105
108106 // if the timeout elapses first, then stop waiting
109107 return ( await Task . WhenAny ( list , timeout ) . ConfigureAwait ( true ) ) == timeout ;
@@ -112,12 +110,12 @@ Task listAwaiter ()
112110
113111 private void EnsureExclusiveExecution ( bool set = false )
114112 {
115- lock ( this . _listAccessLock ) // reused lock
113+ lock ( this . _listAccessLock ) // reused lock
116114 {
117- if ( this . _exclusiveExecution )
115+ if ( this . _exclusiveExecution )
118116 throw new InvalidOperationException ( ) ;
119117
120- if ( set )
118+ if ( set )
121119 this . _exclusiveExecution = set ;
122120 }
123121 }
0 commit comments