@@ -420,12 +420,8 @@ public static void TestCompletionTask()
420
420
421
421
/// <summary>
422
422
/// Ensure that CESPs can be layered on other CESPs.
423
- /// There is and assert in src\Threading\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs
424
- /// line 355 - the scheduler enters in exclusive processing mode when should not
425
- /// it needs more investigations
426
423
/// </summary
427
424
[ Fact ]
428
- [ ActiveIssue ( 2797 ) ]
429
425
public static void TestSchedulerNesting ( )
430
426
{
431
427
// Create a hierarchical set of scheduler pairs
@@ -490,30 +486,13 @@ public static void TestSchedulerNesting()
490
486
}
491
487
}
492
488
493
- // Once all tasks have completed, complete the schedulers
494
- Task . Factory . StartNew ( ( ) =>
495
- {
496
- Debug . WriteLine ( string . Format ( "Waiting for all tasks" , tasks . Count ) ) ;
497
- Task . WaitAll ( tasks . ToArray ( ) ) ;
498
- foreach ( var cesp in cesps ) cesp . Complete ( ) ;
499
- } , CancellationToken . None , TaskCreationOptions . None , TaskScheduler . Default ) ;
500
-
501
- // In the meantime, wait for all schedulers to complete
502
- Debug . WriteLine ( "Waiting for all csps" ) ;
503
- foreach ( var cesp in cesps ) cesp . Completion . Wait ( ) ;
504
-
505
- Debug . WriteLine ( "Done waiting" ) ;
506
- // All tasks should now be done for the schedulers to have completed
507
- foreach ( var task in tasks )
489
+ // Wait for all tasks to complete, then complete the schedulers
490
+ Task . WaitAll ( tasks . ToArray ( ) ) ;
491
+ foreach ( var cesp in cesps )
508
492
{
509
- if ( task . Status != TaskStatus . RanToCompletion )
510
- {
511
- Debug . WriteLine ( "Task didn't run to completion" ) ;
512
- }
493
+ cesp . Complete ( ) ;
494
+ cesp . Completion . Wait ( ) ;
513
495
}
514
-
515
- // All tasks should now be done for the schedulers to have completed
516
- foreach ( var task in tasks ) Assert . True ( task . Status == TaskStatus . RanToCompletion , "All tasks should now be complete" ) ;
517
496
}
518
497
519
498
/// <summary>
0 commit comments