@@ -17,21 +17,21 @@ static async Task Main()
1717
1818 {
1919 Console . WriteLine ( "Standard DataFlow operation test..." ) ;
20- var block = new ActionBlock < int > ( async i => await Delay ( i ) ) ;
20+ var block = new ActionBlock < int > ( async i => await Delay ( i ) . ConfigureAwait ( false ) ) ;
2121 var sw = Stopwatch . StartNew ( ) ;
2222 foreach ( int i in Enumerable . Range ( 0 , repeat ) )
2323 block . Post ( i ) ;
2424 block . Complete ( ) ;
25- await block . Completion ;
25+ await block . Completion . ConfigureAwait ( false ) ;
2626 sw . Stop ( ) ;
2727 Console . WriteLine ( sw . Elapsed ) ;
2828 Console . WriteLine ( ) ;
2929 }
3030
31- await BasicTests . ReadAll ( testSize ) ;
32- await BasicTests . ReadAllAsync ( testSize ) ;
33- await BasicTests . BatchThenJoin ( testSize , 5001 ) ;
34- await BasicTests . BatchJoin ( testSize , 50 ) ;
31+ await BasicTests . ReadAll ( testSize ) . ConfigureAwait ( false ) ;
32+ await BasicTests . ReadAllAsync ( testSize ) . ConfigureAwait ( false ) ;
33+ await BasicTests . BatchThenJoin ( testSize , 5001 ) . ConfigureAwait ( false ) ;
34+ await BasicTests . BatchJoin ( testSize , 50 ) . ConfigureAwait ( false ) ;
3535
3636 {
3737 Console . WriteLine ( "Standard Channel filter test..." ) ;
@@ -43,7 +43,7 @@ static async Task Main()
4343 long total = await source
4444 . ToChannelAsync ( singleReader : true )
4545 . Filter ( i => i % 2 == 0 )
46- . ReadAll ( Dummy ) ;
46+ . ReadAll ( Dummy ) . ConfigureAwait ( false ) ;
4747 sw . Stop ( ) ;
4848
4949 Debug . Assert ( total == repeat / 2 ) ;
@@ -54,11 +54,11 @@ static async Task Main()
5454 {
5555 Console . WriteLine ( "Concurrent DataFlow operation test..." ) ;
5656 var sw = Stopwatch . StartNew ( ) ;
57- var block = new ActionBlock < int > ( async i => await Delay ( i ) , new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = concurrency } ) ;
57+ var block = new ActionBlock < int > ( async i => await Delay ( i ) . ConfigureAwait ( false ) , new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = concurrency } ) ;
5858 foreach ( int i in Enumerable . Range ( 0 , repeat ) )
5959 block . Post ( i ) ;
6060 block . Complete ( ) ;
61- await block . Completion ;
61+ await block . Completion . ConfigureAwait ( false ) ;
6262 sw . Stop ( ) ;
6363 Console . WriteLine ( sw . Elapsed ) ;
6464 Console . WriteLine ( ) ;
@@ -71,7 +71,7 @@ await Enumerable
7171 . Repeat ( ( Func < int , ValueTask < int > > ) Delay , repeat )
7272 . Select ( ( t , i ) => t ( i ) )
7373 . ToChannelAsync ( singleReader : false , maxConcurrency : concurrency )
74- . ReadAllConcurrently ( 4 , Dummy ) ;
74+ . ReadAllConcurrently ( 4 , Dummy ) . ConfigureAwait ( false ) ;
7575 sw . Stop ( ) ;
7676 Console . WriteLine ( sw . Elapsed ) ;
7777 Console . WriteLine ( ) ;
@@ -85,7 +85,7 @@ await Enumerable
8585 . Select ( ( t , i ) => t ( i ) )
8686 . ToChannelAsync ( )
8787 . Pipe ( i => i * 2 )
88- . ReadAll ( Dummy ) ;
88+ . ReadAll ( Dummy ) . ConfigureAwait ( false ) ;
8989 sw . Stop ( ) ;
9090 Debug . Assert ( total == repeat ) ;
9191 Console . WriteLine ( sw . Elapsed ) ;
@@ -100,7 +100,7 @@ await Enumerable
100100 . Select ( ( t , i ) => t ( i ) )
101101 . ToChannelAsync ( )
102102 . Transform ( i => i * 2L )
103- . ReadAll ( Dummy ) ;
103+ . ReadAll ( Dummy ) . ConfigureAwait ( false ) ;
104104 sw . Stop ( ) ;
105105 Console . WriteLine ( sw . Elapsed ) ;
106106 Console . WriteLine ( ) ;
@@ -134,7 +134,7 @@ static void Dummy(long i)
134134
135135 static async ValueTask < int > Delay ( int i )
136136 {
137- await Task . Delay ( 100 ) ;
137+ await Task . Delay ( 100 ) . ConfigureAwait ( false ) ;
138138 return i ;
139139 }
140140}
0 commit comments